PDA

View Full Version : move interval via actionscript


loaded
03-19-2003, 08:42 PM
Hello there flasherz,

I've made a really simple movement example (included).
I want the items to move with a small delay, instead of all at once as thy do now...

Hope someone can help me out with a simple method for this...

Thnx

Billy T
03-19-2003, 09:24 PM
function gotoXPos() {
difX = this._x-this.p_topT;
(Math.abs(difX)<.1) ? this.onEnterFrame=undefined : this._x -= (difX/2);
}
function setDir(clip, xPos) {
clip.p_topT = xPos;
clip.onEnterFrame = gotoXPos;
}
//move buttons:
btn1_btn._x = 600;
//2
btn2_btn._x = 700;
//3
btn3_btn._x = 800;
//
i = 1;
startPos = 10;
function moveBut() {
setDir(_root["btn"+i+"_btn"], startPos);
i++;
startPos += 100;
if (i>3) {
clearInterval(myInterval);
}
}
myInterVal = setInterval(moveBut, 500);


cheers

loaded
03-19-2003, 09:32 PM
Just what i needed!
Got to work on my interval skills!

loaded
03-20-2003, 10:53 AM
Hmmm.... worked a little with the .fla, however I altered it with a simple for loop. However the interval does not seem to work any more now???

What is wrong here? Just when you think you understand????

Billy T
03-20-2003, 11:16 AM
what exactly are you trying to do?

loaded
03-20-2003, 12:41 PM
He there thanx for the reply again....

I'm making an xml based dynamic menu.
I want all the items to move over x but then again with an interval.
In the second version I used a for loop similar to the one in the xml based menu. However I'm not able to set the interval right.
If in you increase the interval in the move2 movie all the items react on the interval??? Instead of that it changes the interval between there movements....

Hope this gives you the idea???

Billy T
03-20-2003, 06:36 PM
I suggest you look up setInterval in the actionscript dictionary

gotta fly

cheers