Problems with Progress bar (_root.clip.gotoAndStop(frame))

  • champi0n
  • Graduate
  • Graduate
  • User avatar
  • Posts: 199

Post 3+ Months Ago

I've made a pre-loader which works fine except for the progress bar i've made.

Code: [ Select ]
totalBytes = Math.round(getBytesTotal() / 1024);
loadedBytes = Math.round(getBytesLoaded() / 1024);
percentDone = Math.round((loadedBytes / totalBytes) * 100);

_root.loader.gotoAndStop(percentDone);

if (percentDone == 100) {
    gotoAndPlay("Scene 2",1);
}
  1. totalBytes = Math.round(getBytesTotal() / 1024);
  2. loadedBytes = Math.round(getBytesLoaded() / 1024);
  3. percentDone = Math.round((loadedBytes / totalBytes) * 100);
  4. _root.loader.gotoAndStop(percentDone);
  5. if (percentDone == 100) {
  6.     gotoAndPlay("Scene 2",1);
  7. }


My preloader scene is 3 frames long, and includes a movie clip of my progress bar. The movie clip progress bar is 100 frames long called "loader".

Layer 1 holds the above actionscript from frame 1-3.
Layer 2 holds a gotoAndPlay(1) actionscript on frame 3.

What im trying to do is link the percentDone, with the frame in my load bar. But it doesnt work.

Am i using or trying to use depreciated commands?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Saul_PL
  • Novice
  • Novice
  • User avatar
  • Posts: 20

Post 3+ Months Ago

I used to have the similar problem so I made something like this:

Into main .fla file i put some code:
Quote:
Frame 1:
var myMCL:MovieClipLoader = new MovieClipLoader();
var myListener:Object = new Object();
myMCL.addListener(myListener);
Frame 2:
myMCL.loadClip("preloader.swf", 50); //I create the same preloader as you but in another .fla file (instant name preloader)
Frame 3:
myListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
_level50._visible = true;
_global.preloadPercent = Math.round((loadedBytes/totalBytes)*100);
_level50.preloader.gotoAndStop(preloadPercent);
_level50.rozmiar.text = Math.round(totalBytes/1000)+" KB ";
_level50.zaladowane.text = Math.round(loadedBytes/1000)+" KB";
_level50.procent.text = Math.round(preloadPercent)+" %";
_level5.stop();
};
myListener.onLoadComplete = function(target_mc) {
_level50._visible = false;
_level5.play();
};

  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1254
  • Loc: Ro

Post 3+ Months Ago

that or use onEnterFrame

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.