A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: AS3, preloader not showing until 90% loaded

  1. #1
    Junior Member
    Join Date
    Nov 2009
    Posts
    13

    AS3, preloader not showing until 90% loaded

    hello everybody,
    I stuck in trouble again,i m using this code for my progress bar but it does not appear on "simulate download" too, it appears for a moment when it reaches nearby 100% & goto next frame
    All my script is written on keyframe & no document class.
    How can i get rid of such an unusual behaviour?

    stop();
    import fl.controls.*;

    addEventListener(Event.ENTER_FRAME,prog);
    function prog(eve:Event)
    {
    prgb.setProgress(stage.loaderInfo.bytesLoaded,stag e.loaderInfo.bytesTotal);

    perc.text=Math.round(stage.loaderInfo.bytesLoaded * 100/stage.loaderInfo.bytesTotal)+"% loaded";
    if(stage.loaderInfo.bytesLoaded==stage.loaderInfo. bytesTotal)
    {
    removeEventListener(Event.ENTER_FRAME,prog);
    removeChild(prgb);
    gotoAndStop(2);
    }

  2. #2
    Senior Member
    Join Date
    May 2010
    Location
    Russia: Western Siberia
    Posts
    268
    Why don't you use ProgressEvent.PROGRESS instead of ENTER_FRAME?

    It works way better and is much easier to use.

  3. #3
    Junior Member
    Join Date
    Apr 2006
    Posts
    28
    I have this exact same issue, does anyone have a solution? here is my code

    Actionscript Code:
    stop();

    this.addEventListener(Event.ENTER_FRAME, loading);

    function loading(e:Event):void{

    var total:Number = this.stage.loaderInfo.bytesTotal;
    var loaded:Number = this.stage.loaderInfo.bytesLoaded;

    logo_loader.scaleX = loaded/total;
    loader_txt.text = Math.floor((loaded/total)*100)+ "%";

    if (total == loaded){
    play();
    this.removeEventListener(Event.ENTER_FRAME, loading);
    }

    }


    there is one vector graphic and text for percentage on this page.

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    When you test your movie, go to View>Bandwidth Profiler and look at the file size of the first frame. Is most of your data on the first frame?

  5. #5
    Designer, Programmer, Musician angelhdz's Avatar
    Join Date
    Mar 2010
    Posts
    971
    I am experiencing this issue too. I have all my content in the 2nd frame, and I have the actionscript class export to frame 2. When simulate download, in the bandwidth profiler, i see how the preloading proccess begins to load data, but the canvas stays "white" completely, and my stage's background color is black. Then, when it reaches 90%, then the black canvas shows with the loader bar and the dynamic text box...that's really weird because in AS2 that did not happen.
    Already mastering AS3. It was so fun. Now into Javascript and PHP and all its libraries

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