PDA

View Full Version : preloader % question



danielthelion
February 5th, 2004, 02:42 PM
hey guys, im sure theres been numerous questions about this, but i couldnt find a string that addressed my particular question.
im trying to get my % # to move along the _X axis with my preloader bar. any suggestions?

SoloDesignz
February 5th, 2004, 06:48 PM
just move the text._x with the preload _x or put the text in a MC and move that MC's _x .... not sure if u can move a text_x

OBCT
February 5th, 2004, 08:24 PM
Give this code a go


_root.onEnterFrame = function()
{
var totalBytes = _root.getBytesTotal();
var loadedBytes = _root.getBytesLoaded();
var percentComplete = (loadedBytes - totalBytes) * 100;

if (percentComplete >= 100) gotoAndPlay(nextScene());

myBar._xscale = percentComplete;
myText._x = percentComplete;
}

myBar would be the instance name of your loading bar and myText would be the instance name of your dynamic or input text box.

Cheers

Voetsjoeba
February 6th, 2004, 02:22 PM
Shouldn't this line:



var percentComplete = (loadedBytes - totalBytes) * 100;

read


var percentComplete = (loadedBytes/totalBytes) * 100;

? ;)

lostinbeta
February 6th, 2004, 02:31 PM
The basic equation for something like this goes like...

loadPercentClip._x = loadBarClip._x+loadBarClip._width

This will move the loadPercentClip first to the _x position of the loadBarClip, and then move it along as the loadBarClip expands in _width. This also assumes the loadBarClips registration point is set to the left (or right) and not centered.

danielthelion
February 6th, 2004, 04:32 PM
hey guys, thanks for all your input and help! ill try that stuff. its actually kinda cool, but last night right after i posted my question here i had an actionscript revelation. it all started to kinda make sense and the script that i added to my preloader script basically just set my instance name "percent"'s _x equal to the _width of my loadbar...i even got the pathing correct. and to my surprise it actually worked...i'm actually learning this stuff! thank you kirupa members!