0
New Here
,
/t5/animate-discussions/as3-preloader/td-p/545035
Dec 07, 2007
Dec 07, 2007
Copy link to clipboard
Copied
I know this has been brought up before. I back tracked
through the forum and I did find a tutorial, but it wanted me to
actually define a new class. Call me crazy, but if something as
(presumably) simple as a preloader needs a new class all for
itself, I shudder to think what more complicated problems could
require.
So, how do I create a preloader using AS3 without having to make any separate .as files?
Oh, and by the way, before anyone asks, what I want to preload is my actual movie. Not anything external, just show my users how much more they have to load before they can view my Flash.
Thanks ahead of time!
So, how do I create a preloader using AS3 without having to make any separate .as files?
Oh, and by the way, before anyone asks, what I want to preload is my actual movie. Not anything external, just show my users how much more they have to load before they can view my Flash.
Thanks ahead of time!
TOPICS
ActionScript
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
1 Correct answer
New Here
,
Dec 07, 2007
Dec 07, 2007
Thanks for the help ockley, but there's one thing in there
that confuses me. First of all, where did root.loaderInfo come
from? Don't you have to at least import flash.display.loaderInfo
first? Obviously, I'm ultra new to AS3, and OOP in general.
(:-)

/t5/animate-discussions/as3-preloader/m-p/545036#M14808
Dec 07, 2007
Dec 07, 2007
Copy link to clipboard
Copied
Hi Audaciator,
you can use loaderInfo from the root and insert it in an ENTER_FRAME event. A code like this should do it:
Put the code below (along with a stop(); command) in the first frame. Add a movieclip with "preloader_mc" as its instance name. Make a 100 frames long animation inside it. I also used a dynamic TextField called "status_txt" (inside the preloader clip) to show some byte info. Finally start your movie from "frame 2".
You can grab the FLA-file here.
All the best to you
/ockley
Code below:
_________________________________________________________________
you can use loaderInfo from the root and insert it in an ENTER_FRAME event. A code like this should do it:
Put the code below (along with a stop(); command) in the first frame. Add a movieclip with "preloader_mc" as its instance name. Make a 100 frames long animation inside it. I also used a dynamic TextField called "status_txt" (inside the preloader clip) to show some byte info. Finally start your movie from "frame 2".
You can grab the FLA-file here.
All the best to you
/ockley
Code below:
_________________________________________________________________
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/animate-discussions/as3-preloader/m-p/545037#M14809
Dec 07, 2007
Dec 07, 2007
Copy link to clipboard
Copied
Thanks for the help ockley, but there's one thing in there
that confuses me. First of all, where did root.loaderInfo come
from? Don't you have to at least import flash.display.loaderInfo
first? Obviously, I'm ultra new to AS3, and OOP in general.
(:-)
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

/t5/animate-discussions/as3-preloader/m-p/545038#M14810
Dec 08, 2007
Dec 08, 2007
Copy link to clipboard
Copied
Ultra new?! Don't you worry. A lot of long time AS2 users
feel the same way as you. There sure is some new ground to cover
with this release, but it's all for the better.
Actually you should think in terms of importing the classes you use in the project, but Flash CS3 lend you a helping hand here. It imports and knows all class imports that starts with "flash" (are there any other classes imported, anyone?).
LoaderInfo() is a class created in the main timeline of any loaded SWF-file on stage. It contains all the properties needed to identify base look-and-feel (width, height, frame rate, swf version etc.). root (no underscore in AS3) can still (in this example) be used to reach the main timeline, and the loaderInfo is available before the INIT.
The Loader() class has a property called contentLoaderInfo there can get the information about the file being loaded into the loader.content property.This is the most used way of preloading, because the loader can reuse the preloader on several movies. The way I showed you it perfectly legal, but you have to implement it on all movies to be loaded.
All the best
Actually you should think in terms of importing the classes you use in the project, but Flash CS3 lend you a helping hand here. It imports and knows all class imports that starts with "flash" (are there any other classes imported, anyone?).
LoaderInfo() is a class created in the main timeline of any loaded SWF-file on stage. It contains all the properties needed to identify base look-and-feel (width, height, frame rate, swf version etc.). root (no underscore in AS3) can still (in this example) be used to reach the main timeline, and the loaderInfo is available before the INIT.
The Loader() class has a property called contentLoaderInfo there can get the information about the file being loaded into the loader.content property.This is the most used way of preloading, because the loader can reuse the preloader on several movies. The way I showed you it perfectly legal, but you have to implement it on all movies to be loaded.
All the best
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/animate-discussions/as3-preloader/m-p/545039#M14811
Feb 22, 2008
Feb 22, 2008
Copy link to clipboard
Copied
Why the preloader have a big daly if the movie on the thame 2
have a linkage?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
New Here
,
/t5/animate-discussions/as3-preloader/m-p/545040#M14812
Feb 22, 2008
Feb 22, 2008
Copy link to clipboard
Copied
Why the preloader have a big delay if the movie on the frame
2 have a linkage?
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

/t5/animate-discussions/as3-preloader/m-p/545041#M14813
Feb 25, 2008
Feb 25, 2008
Copy link to clipboard
Copied
quote:
Originally posted by: sunfirestarter
Why the preloader have a big delay if the movie on the frame 2 have a linkage?
My first guess would be, that you have checked Export in first frame in the linkage dialog. If that isn't the case, I guess you have to be more specific. Do you have the possibility to place a zip with the files you are experimenting with, somewhere.
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

