A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: simple preloader problem....

  1. #1
    TheForceIsStrongWithThisOne dvdvault's Avatar
    Join Date
    Apr 2002
    Location
    Sydney, Australia
    Posts
    778
    Hi All,

    I cant, for the life off me, work out why my preloader bar ain't working

    My first scene is a preloader that preloads the next scene thats on its way...

    I use the following to in frame one of _root timeline:

    __________________

    //initialize text fields
    loadpercent = "0%";
    loadBytes = "0 of " + Math.round((this.getBytesTotal() / 1024) * 1000) / 1000 + " Kb";


    In frame 2 i use the following 'run of the mill' script:

    _____________________

    loadPercent = (Math.floor (this.getBytesLoaded() / this.getBytesTotal() * 100) + "%");
    loadBytes = (Math.round((this.getBytesLoaded() / 1024) * 1000) / 1000 + " Kb of " + Math.round((this.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded.");

    if (this.getBytesLoaded() == this.getBytesTotal()){ //Check for finished loading
    //If loaded, final update to fields
    loadPercent = "100%";
    loadBytes = (Math.round((this.getBytesLoaded() / 1024) * 1000) / 1000 + " Kb of " + Math.round((this.getBytesTotal() / 1024) * 1000) / 1000 + " Kb total Loaded.");
    nextScene();//Where to go once your movie is loaded
    }

    In frame 3 i have a : gotoAndPlay(2);

    NOW everything works except the load bar...which is a MC that has been left orientated...and should grow to the right using the following script from frame 1 of the MC:

    _________________________
    //scale bar horizontally in relation to amount loaded
    this._xscale = ((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);

    frame 2 of the MC has a : gotoAndPlay (1);


    The loadbar doesnt work ....i dont know why...

    have a look here: http://www.millenniumit.com.au

    Any help would be very much appreciated!!!

    CHeers

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Posts
    106
    hi mike


    Just place the following code in the clipevent of the progress bar.This is a single frame preloading so put "STOP" in the frame actions.

    //---------code starts--------

    onClipEvent (enterFrame) {
    this._xscale = ((_root.getBytesLoaded()/_root.getBytesTotal())*100)*10;
    if (((_root.getBytesLoaded()/_root.getBytesTotal())*100)>=100) {
    trace((_root.getBytesLoaded()/_root.getBytesTotal())*100);
    _root.play();
    }
    }
    //-----------code ends--------

    good luck
    gnana

  3. #3
    TheForceIsStrongWithThisOne dvdvault's Avatar
    Join Date
    Apr 2002
    Location
    Sydney, Australia
    Posts
    778
    hi gnana,

    what do you mean by "Just place the following code in the clipevent of the progress bar"

    &

    "This is a single frame preloading so put "STOP" in the frame actions"

    Is there any possible way i could email the .fla to you??

    CHeers mate

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    106

    Thumbs up you can make it

    hi dvdvault,

    Sorry i wrongly mentioned your name in last reply.....
    coming to the point....just do what i say and see the result.

    Create a small rectangle as a movie clip symbol...place that in the first frame and give stop in the frame actions...
    Right click the movie clip symbol.....select object actions...place the given code in the actions window....create another scene and place some heavy images and sounds in it....then run you movied and choose the Show streaming option from the View menu in Test movie.....you might have to change the value 10 in the second line based on the animation.....still couldn't figure out....mail me the FLA.....gnanavelm@goldwire.com......not in my yahoo....


    good luck
    gnana

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