Flex Actionscript 项目 swf 在导出发布版本后不起作用

发布于 2024-09-14 14:56:07 字数 1667 浏览 6 评论 0原文

我尝试仅在 Flex 中使用 AS3 构建一个项目。当我在 Flex 中运行项目时,一切看起来都很好,但是当我导出发布版本时,应该添加的图像就消失了。如果有人能帮助我,我将不胜感激。

      init();

        public function init(loadedVideoCount:Number):void{

                    singleHolder=new singleVideoCont();
                    singleHolder.x=loadedVideoCount*singleHolder.width+2;
                    singleHolder.y=6;
                    singleHolder.buttonMode=true;
                    addChild(singleHolder);
                    this.addEventListener(MouseEvent.CLICK,onClick);

                    showTn();

                }



    private function showTn():void{

            imgLoader = new Loader();
            imgLoader.load(new URLRequest(_tnPath));
                                            imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onProgress);
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImgLoaded);



    }           



    private function onImgLoaded(event:Event):void {
        singleHolder.progBar.alpha = 0;
           var image:Bitmap = imgLoader.contentLoaderInfo.content as Bitmap;

                image.width=TN_WIDTH;
                image.height=TN_HEIGHT;
                image.x=3;
                image.y=3;
                singleHolder.addChild(image); //this line work when I run the project inside flex but the images are gone when I test my release build...

                        imgLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,onProgress);
                        imgLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,onImgLoaded);
                        //imgLoader = null;
                    }

I tried to built a project with AS3 only in Flex. When I run the project in flex, everything looks fine, but when I export the release build, the images that are supposed to be added are gone. I appreciate if someone can help me about it.

      init();

        public function init(loadedVideoCount:Number):void{

                    singleHolder=new singleVideoCont();
                    singleHolder.x=loadedVideoCount*singleHolder.width+2;
                    singleHolder.y=6;
                    singleHolder.buttonMode=true;
                    addChild(singleHolder);
                    this.addEventListener(MouseEvent.CLICK,onClick);

                    showTn();

                }



    private function showTn():void{

            imgLoader = new Loader();
            imgLoader.load(new URLRequest(_tnPath));
                                            imgLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,onProgress);
imgLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,onImgLoaded);



    }           



    private function onImgLoaded(event:Event):void {
        singleHolder.progBar.alpha = 0;
           var image:Bitmap = imgLoader.contentLoaderInfo.content as Bitmap;

                image.width=TN_WIDTH;
                image.height=TN_HEIGHT;
                image.x=3;
                image.y=3;
                singleHolder.addChild(image); //this line work when I run the project inside flex but the images are gone when I test my release build...

                        imgLoader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS,onProgress);
                        imgLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE,onImgLoaded);
                        //imgLoader = null;
                    }

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

雨落星ぅ辰 2024-09-21 14:56:07

添加跟踪语句来查看 _tnPath 的值并添加此侦听器以查看是否收到任何错误:

 imgLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler );

 private function errorHandler(event:IOErrorEvent ):void
 {
    trace( "ioErrorHandler: " + event );
 }

Add a trace statement to look at the value of _tnPath and add this listener to see if you get any errors:

 imgLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler );

 private function errorHandler(event:IOErrorEvent ):void
 {
    trace( "ioErrorHandler: " + event );
 }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文