Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getbytesloaded & getbytestotal 1

Status
Not open for further replies.

Thoe99

Programmer
May 11, 2001
119
US
I have a preloader that I want to actually get the true size downloaded, and what I have so far is a loading bar that is tweened smoothly to a full bar, within 25 frames. The first frame of the main mc has this:

tellTarget ("/loadbar") {
gotoAndPlay (int ( getBytesLoaded()/getBytesTotal()*100/4 ));
}
if (_level0.getBytesLoaded()/getBytesTotal()==1) {
gotoAndPlay (3);
}

I am trying to get it to get the total bytes and divide it by the current bytes downloaded and then multiply it by 100 and divide it by 4, so that I can get an integer less than 25. That way, I'll target the loading mc to go to that certain frame, getting an accurate load.

Frame 2 has this of the main clip has:
gotoAndPlay (1);

But this doesn't work. Can someone tell me what I'm doing wrong?
 
Code:
_root.loadbar.gotoAndStop (int((_root.getBytesLoaded()/_root.getBytesTotal())*100/4));
if (getBytesLoaded() == getBytesTotal()) {
	gotoAndPlay (3);
}

Code:
tellTarget ("/loadbar") {
    gotoAndStop(int((_root.getBytesLoaded()/_root.getBytesTotal())*100/4));
}
if (getBytesLoaded() == getBytesTotal()) {
    gotoAndPlay (3);
}

The first option above is just a simplified version of what you've written.

The second shows your fixed version. The problem lies in the fact that you are not declaring the object in the 'getbytesloaded' and 'getbytestotal' arguments (ie: _level0, or _root). Although you did declare it in the first half of the IF statement.

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
ps: note the change to the IF statement also, although it performs the same function.

dave
dave@pinkzeppelin.com

^^^^^^^^^^^^^^^^^^^^^​
 
Gotcha. How do I target a movie clip within a movie clip? For example, from the main stage, I need mc #1 to go to frame 2, that is within mc #2.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top