
Common Pitfalls
Paul Schoneveld
I'm mainly an ActionScript 3.0 Developer. I do any interactive design elements on a site though and am not limited to working with Flash. I'm experianced with Ajax, JavaScript (jQuery/MooTools), PHP, MySQL, and more.
I used to post tutorials/articles on ClickPopMedia.com and have been working as a freelancer recently.
Check out my blog where I post my portfolio of work.
The answer we seek is in the "linkage properties" of our library symbols.

If you leave checked [default] the
checkbox "Export in first frame" then the first frame of
you Flash Movie won't play until that library symbol is loaded.
In other words, your preloader won't be displayed until almost
everything in your library is loaded.
So now the scenario goes
that you've gone through your library and unchecked that box for all
the symbols, FLVs, graphics, images, and sound objects that are
exported for ActionScript. But, when you try and run your
movie/game/application you get error messages saying that some class
or object that you made doesn't exist! Well you know that's not
true because it existed before you unchecked "Export in first
frame."
The new problem that we are running into is that
Flash is loading code that implements library items that haven't
finished loading yet. Even though that code isn't being
executed, it is still checking all the references withing it to make
sure they exist.
The solution to this problem? Instead of
exporting in the first frame like we were doing before, we will
export in the second frame!
It feels a little messy to do
this, but it will never be noticed by the end user. You have to
drag one instance of each sound object, MovieClip, etc. that has
checked "Export for ActionScript" onto the stage in the
second frame. Then create an empty keyframe on frame 3 and start you
animation/game/app there. Your preloader goes to the frame
label 'begin' when it's done loading, so just add that label to frame
3 and the end user will never see frame 2 with all that stuff on
it.
The final issue that could arise for you, is IF you are
using a Document Class (and if you don't know what that is, it's the
class file associated with your movie. You set it in the
document properties) then all of your code is loaded on frame 1 and
frame 2 is already too late to load your library.
Well, if you've
written clean code using all the proper practices, then you will be
able to turn your entire animation/game/app (not including the
preloader) into one big MovieClip and associate your original
document class with that. Then add that movie clip to the stage
at label 'begin'.
Spread The Word
Related Articles
Attachments
1 Response to "Adding a PreLoader to your AS3 project" 
|
said this on 15 Jan 2009 9:22:22 PM CST
i just lost a fight today
|


Author/Admin)