Hi
I have a test with a SWFLoader loading an application in a different application domain.
Test with SWFLoader is ok when you load the application in the same application domain but when I want a new Application Domain, I have an error message with a flahplayer debug version when I use the unload method.
Is this a bug ?
Error with SwfLoader and new...What version of FlexUnit are you using and, perhaps more importantly, what are you trying to accomplish?
At first glance it sounds like you are retying to run code from a different application domain, but could you clarify before I make any possibly incorrect assertions.
Error with SwfLoader and new...I use FlexUnit 4 and FlexBuilder 3
I want to test the behaviour of a custom class which extends SWFLoader,
including when it loads (and unloads) an application in a new
application domain, but I have this error message so I tried some very
simple tests on SWFLoader.
In my test I just load a swf file in a new application domain and unload
it when it's completed. On the ''unloadAndStop'' method I have this error
message :
TypeError: Error #1009:
at
mx.managers::SystemManager/removeChildBridge()[C:\autobuild\3.3.0\frameworks\pro jects\framework\src\mx\managers\SystemManager.as:4844]
at
mx.controls::SWFLoader/contentLoaderInfo_unloadEventHandler()[C:\autobuild\3.3.0 \frameworks\projects\framework\src\mx\controls\SWFLoader.as:2160]
at flash.display::Loader/_unload()
at flash.display::Loader/unloadAndStop()
at
mx.controls::SWFLoader/load()[C:\autobuild\3.3.0\frameworks\projects\framework\s rc\mx\controls\SWFLoader.as:1334]
at
mx.controls::SWFLoader/commitProperties()[C:\autobuild\3.3.0\frameworks\projects \framework\src\mx\controls\SWFLoader.as:1185]
at
mx.core::UIComponent/validateProperties()[C:\autobuild\3.3.0\frameworks\projects \framework\src\mx\core\UIComponent.as:5807]
at
mx.managers::LayoutManager/validateProperties()[C:\autobuild\3.3.0\frameworks\pr ojects\framework\src\mx\managers\LayoutManager.as:539]
at
mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.3.0\frameworks \projects\framework\src\mx\managers\LayoutManager.as:689]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at
mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.3.0\frameworks\projec ts\framework\src\mx\core\UIComponent.as:8633]
at
mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.3.0\frameworks\project s\framework\src\mx\core\UIComponent.as:8573]
This seems weird that it would have anything to do with FlexUnit.
Can you send me a test case I can use to reproduce?
I wonder too.
Here is the test.
Thanks for your help.
Looks like the attachement perhaps didn't some through. Could you try again?
another try
again ?
for whatever reason it is not coming through. I sent you a private message with my email, just send it there.
ok I can't do it, so I copy it here
?public class TestSWFLoader {
?protected var swfloader:SWFLoader;
?[Before(async,ui)]
?public function setUp():void {
?swfloader = new SWFLoader();
?Async.proceedOnEvent( this, swfloader, FlexEvent.CREATION_COMPLETE, 100 );
?UIImpersonator.addChild( swfloader );
?}
?[After(async,ui)]
?public function tearDown():void {
?swfloader.unloadAndStop();
?UIImpersonator.removeChild( swfloader );
?swfloader = null;
?}
?[Test(async,ui)]
?public function testLoad() : void {
?swfloader.addEventListener(Event.COMPLETE, Async.asyncHandler( this, onLoadComplete, 500 ), false, 0, true );
var loaderctx :?LoaderContext = new LoaderContext();
?loaderctx.applicationDomain = new ApplicationDomain();
?//loaderctx.applicationDomain = ApplicationDomain.currentDomain;
?swfloader.loaderContext = loaderctx;
?swfloader.load('resources/Example.swf');
?}
?protected function onLoadComplete( event:Event, passThroughData:Object )
?{
?Assert.assertEquals(swfloader.source, 'resources/Example.swf');
?}
?}
Okay, I can replicate this.
Having seen it, I can also now replicate it out of the FlexUnit framework though. Seems like this the specific issue with the FU framework is when we add it to the UIImpersonator container, the bridgeToFocus manager is never properly created internally.
I can create the same circumstance in a regular application too if I follow a similar pattern. Willing to look into this more but might need to loop in some others so I don't think it will be a quick fix.
When you have time, please file this as a bug in the FlexUnit jira. Adobe is off this week, so it will be at least next week before I can get an opinion on some of my proposed fixes.
Mike
great i'll do that
thank you
No comments:
Post a Comment