- Home
- Tutorials
- Flash
- Intermediate
- Preloading in ActionScript 3.0, the Easy Way

Loading the SWF File
Christopher Skyi
Brooklyn Sky Design was created in early 2007 to address the needs of artists, individuals, and small & medium size business who are seeking an affordable web presence on the internet. We provide internet programming and web site design and build services.Brooklyn Sky Design has several years experience in both application web programming (e.g., http://ASP.Net, Flash-Actionscript) and web site design and building. Brooklyn Sky Design recognizes the importance of solid design principles based known usability principles. In other words, we make sure your site not only looks great but that it also works and functions from a user's point of view.
At this point, we have two choices. First, we can add the loader to the LoadSystem’s main timeline:
addChild(loader);
This statement adds the loader as a display object child to the SWF file’s main Timeline. The loader is at depth 0 in the display of the main Timeline (i.e., movieClip) object. We know that by from these two trace statements:
trace("the 'loader' object descends/is contained in this specific DisplayObjectContainer:"+loader.root);
trace("depth of 'loader' object = "+getChildIndex(loader));
they return:
The 'loader' object descends/is contained in this specific DisplayObjectContainer:[object MainTimeline].
depth of 'loader' object = 0.
Second, we can add the loader to the Stage so it’s at dept 0 in Stage’s child list:
stage.addChild(loader);
If we use these trace statements:
trace("The 'loader' object descends/is contained in this specific DisplayObjectContainer:"+loader.root);
trace("Object at index 1 is: "+stage.getChildAt(1));
trace("Depth of 'loader' object = "+stage.getChildIndex(loader));
they return:
The 'loader' object descends/is contained in this specific DisplayObjectContainer:[object Stage].
Object at index 1 is: [object Loader].
Depth of 'loader' object = 1
So which should we use? Colin Moock in Chapter 20 of Essential ActionScript 3.0 suggests adding it to the Stage. To be honest, I’m not sure what the advantages or disadvantages are, and this “brief” tutorial is becoming rather long, so since he’s Colin Moock, I’ll just play it smart and follow his example.
Spread The Word
Related Links
Attachments
5 Responses to "Preloading in ActionScript 3.0, the Easy Way" 
|
said this on 08 Apr 2009 7:03:12 AM CST
Thanks!
Building the W |
|
said this on 20 May 2009 5:58:40 AM CST
Thanks, this is a fantast
|
|
said this on 22 Jun 2009 9:25:48 AM CST
Christopher, your tutoria
I've tried - stage.scal - lo - loader.width = g - loader.scaleX - loader.con - loader.c and a I've pla I'd Thank you v Regards, Cesa |
|
said this on 09 Nov 2009 11:22:16 PM CST
how do you access variabl
|


Author/Admin)
