Posted in Uncategorized on May 24th, 2010 by sHTiF
Hi there yes i am still alive, anyway today i am here to share a little observation i just did. I am sure that many of you Flash programmers that actually do some low level programming are aware of this implementation and i am not here to describe the method into detail, if you wish me to do so just write me a note. To put it simply its about embedding external SWFs for example skins into the main swf then decompressing it into memory using loadBytes and accessing its library resources through application domain.
I am used to using this design in most of my applications that use dynamic flash skins, so i can have skins separate for the graphician/designer without any code just class linkages and application code itself in Flash Builder 4. However today after migrating one of such application skins into Flash CS5 the whole concept stopped working. I was like what the hell… and jumped right into the problem. Firstly let me say that there is no one out there that probably encountered this problem or they did but they sure didn’t share the knowledge. Even if the solution is pretty simple and one of those “ohhh so this is it” still it was frustrating to no end.
So what Flash CS5 do that Flash CS4 obviously didn’t? I added bunch of traces into my SkinManager and compile my Flash Builder 4 project what do i see, the COMPLETE event for the loadBytes gets fired but even after that i still see the swf itself being decompressed into memory so its still loading after the INIT and COMPLETE events. So i added a trace for the loader content right after COMPLETE… ok its there but what do i see? MainTimeline__Preloader__ or something like that, what preloader? I don’t have any preloader in my skin.
So back to the Flash CS5 there is something fishy in the state of Adobe. So i was browsing the settings all over the place and bingo. Checking the Publish Settings->Flash->Advanced ActionScript Settings->Library Path there is some new stuff firstly textLayout.swc which is the new TLF engine. Of course thats understandable, however right below the Library path settings i see some new RSL settings which is set to RSL and a default preloader method is specified. Ok so what this does is add a RSL preloader before your actual swf which is handling your RSL loading thats nice and all but that also means that during loadBytes call the preloader loads first which consecutively fires COMPLETE event even if the actual swf is being loaded after it. Thats baaad, baaad adobe ;) But the solution is really simple in the RSL settings instead of using RSL just use Merged into Code. Simple as that.
However there are some downsides to this, firstly the TLF library is quite large almost 200kB secondly this means that the TLF library is merged in its current state into your swf so you will not have the advantage of it being checked online for its current version. For me these are not downsides since i simply skipped the usage of TLF inside my skins. But its up to you what you need.


