importing flash symbols from an external SWF using URLrequest
hello.
i'm trying several days import flash symbols flex application.
i can't @embed because swf file contains skins not available locally need use urlrequest.
this i've got far.
1. created flash file, lets call foo.swf contains several elements in library , each element has both `export actionscript` , `export runtime sharing` on. 1 of elements called 'test' movieclip of image.
2. created flex project creates swf flashskins.swf contains following wrapper class:
package
{
import flash.display.sprite;
public class wrapper extends sprite
{
[embed(source="foo.swf",symbol="test")]
[bindable]public static var test: class;
}
}
i tested make sure class fetchs symbols flash file properly
using following code:
<fx:script>
<![cdata[
public var wrapper:wrapper;
]]>
</fx:script>
<mx:image source="{wrapper.test}"/>
it loads image , shows properly.
3. created swf file fetch flashskins swf , import wrapper class it. fail.
public function loadskins():void
{
bgloader = new loader();
var bgurl:urlrequest = new urlrequest('http://files.xpogames.com/flashskins/flashskins.swf');
bgloader.contentloaderinfo.addeventlistener(event.init,onloaded);
bgloader.load(bgurl);
}
public function onloaded(e:event):void {
var clazz:class = bgloader.contentloaderinfo.applicationdomain.getdefinition('wrapper') class;
var a:object = new clazz();
theimage.source=a.test;
}
]]>
</fx:script>
<mx:image id="theimage" />
i tried using getdefinition 'wrapper' or 'wrapper' on both cases error variable not defined.
any ideas?
did try using event.complete instead of event.init?
More discussions in Flex (Read Only)
adobe
Comments
Post a Comment