This content has been marked as final. Show 2 replies
the loaded swf is accessible via the instance name of the MC that loaded it, so _root.countryClip.onPress should work. Now when you look at the Flash Help for loadMovie(), you'll find this:
Using event handlers with MovieClip.loadMovie() can be unpredictable. If you attach an event handler to a button by using on(), or if you create a dynamic handler by using an event handler method such as MovieClip.onPress(), and then you call loadMovie(), the event handler does not remain after the new content is loaded.
So this should be the reason it's not working. One solution would be checking the loading progress, and assign the event when the clip is fully loaded. You can use something like the attached code, or use the MovieClipLoader class to load the swf and use it's events (e.g. onLoadInit) to assign the onPress event.
Blemmo, you rock. You've jogged my memory, I think I remember hearing something about that before. Having MC's 'forget' event handlers that were set before an external swf load seems like a really unintuitive 'feature', though. Is this considered to be a bug in Flash or is this really the way it's supposed to work? (understanding the logic behind this would make it easier to remember.)
Thanks much for your sample code, I'll try it out this morning.