2012-03-05 56 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%"/> 
相关问题