PDA

View Full Version : is clean timeline preloading possible?



sinclairc5
September 20th, 2009, 07:36 PM
Currently i use a class i made for preloading the swf from within my Document (http://www.kirupa.com/forum/attachment.php?attachmentid=50792&stc=1&d=1253489571) class, see attached files. Now the current method i use is to preload a flash project is to have the first frame empty, the second frame container what ive come to call a sprite dump. The sprite dump is a movieclip containing all the assets used throughout the project all with "Export in first frame" unchecked.

My Document (http://www.kirupa.com/forum/attachment.php?attachmentid=50792&stc=1&d=1253489571) class creates an instance of DocumentPreloader (http://www.kirupa.com/forum/attachment.php?attachmentid=50789&stc=1&d=1253488365) and adds it to the stage. By applying listeners to the DocumentPreloader (http://www.kirupa.com/forum/attachment.php?attachmentid=50789&stc=1&d=1253488365) i listen for progress and completion.

Upon completion i gotoAndStop( 3 ); by skipping over the 2nd frame provides reference to the assets. Once on the 3rd frame i can instantise any of the assets included in the sprite dump.

This method works fine! however im looking for a method of removing the need for a sprite dump. For a completly timeline free preloading solution, if indeed its even possible. Why? just because i want to know if i can!

One solution may be to load in an swf containing all the assets i require, and i believe that would work. However i build viral games! which means that i need my games to be self contained in one swf.

Any suggestions, solutions or hints as to whether this is even possible! The attached files show the current method, you'll need to change the package descriptions to use them.

Scythe
September 21st, 2009, 12:23 AM
Well, some games are small enough to not need a preloader. Otherwise, your method is the best I've come across that only requires one SWF.

I'm curious, what is addFrameScript? I see what it does, but I can't find a definition in your code or in the help docs.

sinclairc5
September 21st, 2009, 04:24 AM
addFrameScript runs script on the timeline once all assets are fully loaded! I built the FrameUtils class because i was sick of having to detect if the frame was fully loaded before running script.

Its not well documented! but from my perspective it enables less timeline coding which is awsome.

>> Article on addFrameScript (http://gamesandtech.wordpress.com/2008/07/28/actionscript-3-hidden-gem-addframescript/)

jt_developer
September 23rd, 2009, 08:51 AM
I use the "sprite dump" method on all my projects. This so far has been the only way to get it working correctly on every platform. Its completely stupid however until Adobe realise that their code developers have not idea what they are doing we'll have to stick to this for now. Lets hope CS5 will fix the problem (which is exactly what I was hoping for with CS4)

sinclairc5
September 23rd, 2009, 09:03 AM
there was a preview of Viper aka CS5 at FOTB
Read More >> (http://cs5.org/?p=238)

jt_developer
September 23rd, 2009, 10:55 AM
Nice. I hope Adobe Max shows some more though. So far there are few breakthroughs. I'm hoping they will include auto class setup for instant editing (i.e. set up the usual package, import and instantiating function to speed things up for coders)

sinclairc5
September 23rd, 2009, 11:02 AM
From what i understand Flash CS5 has an improved actions panel. Although i dont believe they have gone to town on it instead opting for further intergration between Flash builder aka Flex builder and Flash. Personally I currently prefer Flash Develop as I have no use for MXML, but if the integration is substantial enough it may be worth migrating to FB. Still no hint of a solution in CS5 for my preloader predicament so far.