2012-03-05 97 views
1

Hai我有一個應用程序嘗試加載swf,但我無法加載swf我得到以下錯誤。Flex:類型強制失敗:無法將flash.display :: Loader @ 47262f1轉換爲mx.core.IUIComponent

TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::[email protected] to mx.core.IUIComponent. 
at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::addingChild()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:3900] 
at mx.core::Container/addChildAt()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:2606] 
at mx.core::Container/addChild()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\Container.as:2534] 
at slideSelection/init()[C:\Users\Administrator\Adobe Flash Builder 4\slideSelection\src\slideSelection.mxml:26] 
at slideSelection/___slideSelection_Application1_creationComplete()[C:\Users\Administrator\Adobe Flash Builder 4\slideSelection\src\slideSelection.mxml:3] 
at flash.events::EventDispatcher/dispatchEventFunction() 
at flash.events::EventDispatcher/dispatchEvent() 
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:12266] 
at mx.core::UIComponent/set initialized()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1577] 
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:759] 
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.0.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1072] 

我的代碼加載SWF

var request:URLRequest = new URLRequest("http://xx/loading.swf"); 
       var loader:Loader = new Loader() 
       loader.load(request); 
       addChild(loader); 

回答

2
  var request:URLRequest = new URLRequest("http://name.swf"); 
      var loader:Loader = new Loader() 
      loader.load(request); 
      uic.addChild(loader); 

      <mx:UIComponent id="uic" width="100%" height="100%"/> 
相關問題