ss888
ss888

Reputation: 1748

Flash AS3 Preloader

I've got a Flash AS3 animation that is completely coded in an .as file. The only thing on the timeline is the background image. All of the movieclips are Exported for ActionScript in frame1.

How would I go about adding a preloader into the .as file? I have tried a couple that I've found through Google but they don't seem to work as the .as file seems to be loaded instantly.

Any help greatly appreciated, S.

Below is a stripped-down version of my as file:

package {
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.display.*; 

import gs.TweenLite;
import gs.easing.*;

public class rookbeareFarmClass extends MovieClip {             
    private var F1_Title:F1_Title_Keepitsimple;     

    public function main() {                    
        frame01();          
    }       

    // start frame 1 //
    private function frame01():void {           

        F1_Title = new F1_Title_Keepitsimple();
        addChild(F1_Title); 
        F1_Title.x=231;
        F1_Title.y=93;          
        F1_Title.alpha=0;               

        //Tween in
        TweenLite.to(F1_Title,2,{alpha:1,delay:0.5,ease:Cubic.easeOut,overwrite:0});                    

        //Tween out
        TweenLite.to(F1_Title,2,{alpha:0,delay:4.5,ease:Cubic.easeOut,overwrite:0});                    

    }

}

}

Upvotes: 1

Views: 561

Answers (2)

Corey
Corey

Reputation: 5818

I recommend compiling the SWF without a pre-loader - then create a separate "pre-loader" SWF that loads your main SWF. This will give you the most accurate loading information. Once the load is complete, you can call a public (init) function to start the application.

Upvotes: 1

alxx
alxx

Reputation: 9897

Your movieclips and any heavy thing not needed for preloader have to be in frame 2, not 1. Preloader should occupy frame 1. Now your movie isn't probably loading instantly, it takes time to load fully and only then starts.

Upvotes: 0

Related Questions