A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Preloader

  1. #1
    Junior Member
    Join Date
    Nov 2010
    Posts
    12

    Preloader

    I keep on making preloaders from tutorials in AS3 but none of them work
    everything is export to 2 frame Im using CS5
    I tried external internal all I want is a simple "Line in a box"

  2. #2
    Junior Member
    Join Date
    May 2006
    Posts
    7
    looked up the first link for as3 preloader and got this:

    Actionscript Code:
    stop();  

    //Import the required assets
    import flash.display.*;
    //Stop the playhead while loading occurs
    this.stop();

    //Create a listener to call the loading function as the movie loads
    this.loaderInfo.addEventListener (ProgressEvent.PROGRESS, PL_LOADING);

    /*This is the main function, basically it grabs the total and loaded bytes,
    calculates a percentage, and displays it by stretching the bar and adjusting
    the textfield display. If your bar/textbox instancenames are NOT lbar/lpc,
    you'll need to adjust this code to match your instance names*/

    function PL_LOADING(event:ProgressEvent):void {
    var pcent:Number=event.bytesLoaded/event.bytesTotal*100;
    //Stretch the bar
    lbar.scaleX=pcent/100;
    //Display the % loaded in textfield
    lpc.text=int(pcent)+"%";
    //If the movie is fully loaded, kick to the next frame on the main timeline
    //You may wish to change the gotoAndStop(2) to a gotoAndPlay(2)
    if(pcent==100){
    this.gotoAndStop(2);
    }
    }
    Attached Files Attached Files

  3. #3
    Junior Member
    Join Date
    Nov 2010
    Posts
    12
    I found that one too
    I think I'm doing something wrong

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center