PDA

View Full Version : simple script needed


avelives
04-10-2003, 06:47 PM
i need a peice of script that will incriment a value from 1 to 100 then stop at 100 !!
I have the idea that 'value++' should incriment the upwards but how do you set the initial number for 'value'
this is to go on main timeline so preferably no enterframe functions can be used.

magicwand
04-10-2003, 08:31 PM
what kind of loop are you going to use?
frame loop?
for loop?
???

annexion
04-10-2003, 08:48 PM
If you're using Flash 5, the only way to do something like that on root is to use a for loop...

for(value=0;value<=100;value++){
//actions here
}

But that does it nearly instantly, so, that probably won't work for your situation.

If you're using Flash MX, however, then you can do something like the following.

value=0;
_root.onEnterFrame=function(){
if(value<=100){
value++;
}
}

That would solve the speed issue.

Good luck.

avelives
04-14-2003, 02:12 PM
sorry about the late reply but i didnt get sent an e-mail telling me people had replied.
Right ok, first magicwand not sure what you mean here i simply need a value (which as point of interest is the volume of a MP3 soundloop) to start at 1 and then increment up fading the sound in and stopping when it gets to 100.
annexion i will try what you suggested thanks..