Hi –
Have a preloader bar that stretches from left to right until it fills a gauge in the background-- standard stuff.
Also have a KB numerical reader that calculates from 0 to 100%-- again standard stuff.
I would really like the numerical reader to follow the right hand side of the preloader bar as it grows from left to right. Can’t really figure it out.
Here is the preloader code-- pretty standard-- please, someone, help me make the KB reader move with the load bar width.
Thanks in advance, sure it must be simple, but confused as heck.
this.stop();
// Stop movie and do the preloader.
myInterval = setInterval(preloader, 1);
function preloader() {
if (getBytesLoaded()>=getBytesTotal()) {
_parent.gotoAndPlay(3);
clearInterval(myInterval);
}
loadbar._xscale = (getBytesLoaded()/getBytesTotal())*100;
loadtext.text=Math.round(getBytesLoaded()/getBytesTotal()*100)+"%";
}
system
September 19, 2004, 1:45pm
2
vagabond007:
Hi –
Have a preloader bar that stretches from left to right until it fills a gauge in the background-- standard stuff.
Also have a KB numerical reader that calculates from 0 to 100%-- again standard stuff.
I would really like the numerical reader to follow the right hand side of the preloader bar as it grows from left to right. Can’t really figure it out.
Here is the preloader code-- pretty standard-- please, someone, help me make the KB reader move with the load bar width.
Thanks in advance, sure it must be simple, but confused as heck.
this.stop();
// Stop movie and do the preloader.
myInterval = setInterval(preloader, 1);
function preloader() {
if (getBytesLoaded()>=getBytesTotal()) {
_parent.gotoAndPlay(3);
clearInterval(myInterval);
}
loadbar._xscale = (getBytesLoaded()/getBytesTotal())*100;
loadtext.text=Math.round(getBytesLoaded()/getBytesTotal()*100)+“%”;
}
loadbar._xscale = (getBytesLoaded()/getBytesTotal())*100;
loadtext.text = Math.round(getBytesLoaded()/getBytesTotal()*100)+“%”;
loadtext._x = loadbar._x+loadbar._width;
you may need to add/subtract something to it.
system
September 19, 2004, 6:40pm
3
stringy:
loadbar._xscale = (getBytesLoaded()/getBytesTotal())*100;
loadtext.text = Math.round(getBytesLoaded()/getBytesTotal()*100)+“%”;
loadtext._x = loadbar._x+loadbar._width;
you may need to add/subtract something to it.
thank you very much!!! worked like a charm!
–Cheers!
system
September 19, 2004, 7:27pm
5
I’m looking to do something like this as well but my AS is a little different. I was trying to apply this code to mine but doesn’t seem to work.
On my loader bar:
onClipEvent(load) {
total = _parent.getBytesTotal()/1000;
}
onClipEvent(enterFrame) {
current=_parent.getBytesLoaded()/1000;
if (total == current&¤t > 5) {
_parent.gotoAndPlay(2);
}
else {
_parent.loadAmount = Math.round (current/total*32);
this._xscale = Math.round (current/total*100);
}
}
And my text box has a variable name of loadAmount. What do I need to modify in your code to apply it to my own? Thanks in advance.
system
September 19, 2004, 7:44pm
6
I’m looking to do something like this as well but my AS is a little different. I was trying to apply this code to mine but doesn’t seem to work.
On my loader bar:
onClipEvent(load) {
total = _parent.getBytesTotal()/1000;
}
onClipEvent(enterFrame) {
current=_parent.getBytesLoaded()/1000;
if (total == current&¤t > 5) {
_parent.gotoAndPlay(2);
}
else {
_parent.loadAmount = Math.round (current/total*32);
this._xscale = Math.round (current/total*100);
}
}
And my text box has a variable name of loadAmount. What do I need to modify in your code to apply it to my own? Thanks in advance.
give the textfield an instance name of myText
_parent.loadAmount = Math.round(current/total32);
this._xscale = Math.round(current/total 100);
_parent.myText._x = this._x+this._width;
system
September 19, 2004, 7:54pm
7
Thanks very much You rule.
system
September 19, 2004, 8:21pm
8
can you guys post a fla. because i can’t seem to get it going.
system
September 20, 2004, 2:15pm
9
Gupps,
Here is the fla. Hope this helps, if you have any questions about it post them here because I can’t check my email from work.
here
system
September 20, 2004, 2:45pm
10
hi beneath the sky,
the link is dead.
system
September 20, 2004, 3:20pm
11
Gupps,
Sorry about that, I was in a hurry when I posted it. I will fix it when I get home later this afternoon.
edit: link is fixed
system
September 21, 2004, 12:57pm
12
thanks beneath the sky. I’ll take a look at that right now