PDA

View Full Version : [FMX] random movement tut



fusi
July 19th, 2003, 01:37 PM
hello!

i successfully got the random tuorial working. now i'm lokking for a function for a button to stop and start the random movement at will. i dont want to change frames, im just need a function to break the movement and make the mcs stay put...

i hope you can help!:)

tnx
fusi

λ
July 19th, 2003, 01:53 PM
MovieClip.prototype.moveIf = function(move){
this.onEnterFrame = function(){
if(move == true){
move();
}
}
}
//example usage

theClip.moveIf(1 == 1);

//in this example theClip will always move. you can use any conditional statement though.


or with a button:

//enter the prototype above.

//code on main timeline:


toggle_btn.onRelease = function(){
if(move == undefined){
var move = true;
}
move = !move
}

randomMove.moveIf(move);

fusi
July 19th, 2003, 02:41 PM
hello njs!

tnx 4 that!

would that button work if the move-function werent in the mc's but in the main-timeline aswell?

i attached a fla so you can see what i mean.

and another problem i guess is that i create the mc's by a for-loop...and i want to stop em moving and stay put when i click on them...so i think i need to put the "stop-order" somewhere in the mcs themselves.

i hope you understand what i mean...:alien: