uɐʎɹ ррoʇ uɐʎɹ bio photo

uɐʎɹ ррoʇ uɐʎɹ

Hello. Is is me you're looking for?
僕は猿ーロボット。
robotic life signs.
makes noise, hears sounds, intafon.
affe auf deux roues.

Email Github Github Gist Last.fm Soundcloud Flickr

Just a quick note to mark one subtle difference between the way that the Flash player loads and initializes .swf files that have been loaded into another movie. This effects both the Flash 7 & 8 players. Hopefully this will find its way into the google gaze and help some cross-platform developer out there.

The scenario: I have been recently working on a project in which I am loading a sub-menu represented by a swf into the main flash movie. I am then dynamically assigning a sub-menu class to that new swf upon the onLoadInit call that is fired from the MovieClipLoader class.

The problem: once the .swf was loaded, I wanted to call the init() function that resides in the submenu class. Unfortunately, if init() was called when onLoadInit() was triggered, init() was fired before linked library items in the .swf were available.

Two solutions: One solution that worked was ridiculous. If I used an interval to delay the init() call for a half second (or less even), this was enough time. The other more sensible solution was to put this.init() in a frame of the timeline of the loaded .swf. This worked. My intuition said to put the this.init() call on frame 2, but it actually worked in frame 1. I develop in OSX.

The result: On windows machines, frame 1 was too early to have the this.init() call as well. The init call had to be moved to frame 2 in order for the symbols that were being exported in frame 1 to be available, particularly on windows machines. Frame 1 was fine for OSX.

I should have followed my intuition on this one. Having used Director for many years and Flash since Flash 3, I’ve come to distrust the fact that published Macro-dobe “movies” will actually perform properly on the first frame. Its not a huge work around, but I thought that this difference between the way the player performs in OSX and Windows (among others) was important to note.