I embedded a swf file in my application
<mx:SWFLoader source="@Embed(source='mod/VideoModule.swf')" width="50" height="50" id="loader" creationComplete="initLoader()" />
now with the help of the flex documentation I wanted to interact with my loaded swf by creating a SystemManager
[Bindable]
public var loadedSM:SystemManager;
private function initLoader() : void {
trace(loader.content);
loadedSM = SystemManager(loader.content);
var b: Button = loadedSM.application["button1"] as Button;
b.addEventListener(MouseEvent.CLICK, test);
}
But when starting the application the error#1034 occurs and says that Main__embed_mxml_mod_VideoModule_swf_856293516@33f53c1 could not be converted into mx.managers.SystemManager
any ideas?
thanks in advance
Sebastian
So firstly i’d use the complete event of SWF loader ad the creationComplete event will fire when swf loader is created, not with it’s contents have loaded.
Then i would also pass the FlexEvent argument when the event fires. That event gives you access to the instance of SWFLoader. SwfLoader then has a property called content which will give you access to the loaded swf. If the swf then exposes a property named button1 you could do something like: