2010-08-15 43 views
0

我试图只在Flex中使用AS3构建项目。当我在flex中运行项目时,一切都很正常,但是当我导出发布版本时,应该添加的图像消失了。我很感激有人能帮助我。在导出发布版本后,Flex Actionscript项目swf不工作

 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; 
        } 
+0

您是否使用相对或绝对URL来识别这些图片? – 2010-08-15 23:35:19

+0

我从youtube搜索api中获得了这些图片。我假定它返回了一个http地址(url)。 – FlyingCat 2010-08-15 23:45:08

回答

1

添加trace语句来看看_tnPath的价值,并添加此监听器,看看你得到任何错误:

imgLoader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler); 

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

谢谢。我已经参与了我的项目。谢谢您的帮助。 – FlyingCat 2010-08-17 02:48:17

相关问题