This content has been marked as final. Show 10 replies
You should be setting the listener on the loaded swf using the complete event of the SWFLoader.
You could have a skin SWF pointed to by your application CSS file instead.
And if you want to use the SWFLoader to load the swf and listen for events, the loaded swf must fire the events. In a listener function for the complete event of the SWFLoader you can retrieve a reference to the loaded swf and then register event listeners for the events the loaded swf fires.
Thanks the for the help!
While searching for info on the completed event I stumbled upon this little bit of code:' home.content.addEventListener' and that did the trick! Just adding the '.content' was enough.
Now I'm wondering how to test against it. I tried: 'if (event.target == home)' as well as using 'home.content' and it doesn't seem to be working. Anyone know how this is done?
What is your current code?
private function overHandler(event:MouseEvent):void
if (event.target == home)
<mx:SWFLoader id="home" source="../home.swf"/>
if (event.currentTarget.name == "home")
Thanks for the help! I tried the code you posted, ' if (event.currentTarget.name == "home") ' but it didn't seem to work either. Could it be that I need to reference the swf inside the SWFLoader?
Ah, you are now using home.content.addEventListener
Then event.target.name would give you the instance name of the button in the loaded swf
And if you retrieve a reference to the loaded swf:
var clip:MovieClip = home.content as MovieClip;
if(clip.parent.parent.name == "home") trace("True!");
The path to the SWFLoader depends here on the nesting of the button in the loaded swf.