Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

AS3 Preloader

New Here ,
Dec 07, 2007 Dec 07, 2007
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!
TOPICS
ActionScript
582
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 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. (:-)
Translate
Guest
Dec 07, 2007 Dec 07, 2007
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:
_________________________________________________________________
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
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. (:-)
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 08, 2007 Dec 08, 2007
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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 22, 2008 Feb 22, 2008
Why the preloader have a big daly if the movie on the thame 2 have a linkage?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 22, 2008 Feb 22, 2008
Why the preloader have a big delay if the movie on the frame 2 have a linkage?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 25, 2008 Feb 25, 2008
LATEST
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.


Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines