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

  • champi0n
  • Graduate
  • Graduate
  • User avatar
  • Joined: May 05, 2006
  • Posts: 199
  • Status: Offline

Post December 3rd, 2006, 5:07 pm

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?
[PHP SOURCE CODE ENCRYPTION SOFTWARE] -- Protect your valuable source code!
Add product licensing to your encrypted php scripts, expiry dates and locking to specific ip's or domains.
Protect. Lock. Distribute.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post December 3rd, 2006, 5:07 pm

  • Saul_PL
  • Novice
  • Novice
  • User avatar
  • Joined: Nov 26, 2006
  • Posts: 20
  • Status: Offline

Post December 3rd, 2006, 6:44 pm

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
  • Joined: Nov 05, 2004
  • Posts: 1254
  • Loc: Ro
  • Status: Offline

Post December 8th, 2006, 1:41 am

that or use onEnterFrame
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 43 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
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.