Groups | Blog | Home
all groups > flash actionscript > april 2004 >

flash actionscript : Why does it not work?


MiniMurderdoll
4/20/2004 9:36:55 PM
Hey, i have the code :

[Q]
on (release, keyPress "<Down>"){
if (_root.arm._rotation >= 0) {speed = -1
}
else if (_root.arm._rotation <= 0) {speed = +1
}
}
[/Q]

How can i add so that as soon as the rotation = 180?, the speed = 0 And then
the code finishes?
Gerrard
4/20/2004 10:19:52 PM
Could this work?

on (release, keyPress "<Down>") {
if (_root.arm._rotation>=0&_root.arm._rotation!=180) {
speed = -1;
} else if (_root.arm._rotation<=0&_root.arm._rotation!=180) {
speed = +1;
} else {
speed = 0;
}
}

MiniMurderdoll
4/21/2004 3:21:16 PM
Ooooh, thanks for that, is there a way to keep checking to see if its 180
rather that only once. Like loop that bit until its 180.

Or like an until command when it loops until the condition of speed = 0 is
met. I think that would be the best way.
Gerrard
4/23/2004 12:17:30 PM
Not sure exactly what you mean, but maybe use a movieclip with an onEnterFrame function to preform the loop and another frame to stop the loop?.

AddThis Social Bookmark Button