tags:

views:

33

answers:

0

hi i have problem with swfLoader in flex, when i close following code in click method i can easly add many swf to main application

 <mx:VBox id="content" width="100%" height="100%" ></mx:VBox>

  public function doIT():void


{
        var swfLoader1:SWFLoader = new SWFLoader;
       swfLoader1.source = "DayProfileElement.swf";
       swfLoader1.percentHeight = 100;
       swfLoader1.percentWidth = 100;
       swfLoader1.name = "a";
       swfLoader1.id = "b";


   var panel1:Panel = new Panel;
   panel1.percentHeight = 100;
   panel1.percentWidth = 100 / 4;
   panel1.name ="c";
   panel1.id = "d";
   panel1.addChild(swfLoader1);

   content.addChild(panel1);  

}

it works when i push the button like once per second, but when i do it very fast i have following error:

TypeError: Error #1034: Type Coercion failed: cannot convert mx.core::ClassFactory@a93a671 to mx.core.IFactory.
 at mx.charts.series::AreaSeries/get legendData()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\series\AreaSeries.as:327]
 at mx.charts.chartClasses::ChartBase/get legendData()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\chartClasses\ChartBase.as:1161]
 at mx.charts::Legend/populateFromArray()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\Legend.as:666]
 at mx.charts::Legend/commitProperties()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\charts\Legend.as:449]
 at mx.core::UIComponent/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5807]
 at mx.managers::LayoutManager/validateProperties()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:539]
 at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:659]
 at Function/http://adobe.com/AS3/2006/builtin::apply()
 at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
 at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]

when i close adding those swfs in loop i have the same error, it looks like child apps couldn't access certain objects that were instantiated by another child app, so what can i do?