how do i make a movie clip move using the spacebar, when it reaches a point it will move backwards.
anyone can help?
how do i make a movie clip move using the spacebar, when it reaches a point it will move backwards.
anyone can help?
userKey= new Object();
userKey.onKeyDown= function(){
if (Key.getCode() == Key.SPACE){
your_mc._x+=10;
}
}
Key.addListener(userKey)
that will get you moving. well that is in mx terms, anyway.
erm… there is some errors. can u explain the functions? thx
hmm the errors must be because of the difference in mx and mx 2004. it ran good for me in mx.
//creates a new object that will monitor keystrokes
userKey= new Object();
//when a keypress is detected, the userKey object will perform this function
userKey.onKeyDown= function(){
//if space bar is down, add 10 to the x value on your_mc
if (Key.getCode() == Key.SPACE){
your_mc._x+=10;
}
}
//add the userKey object to the Key class
Key.addListener(userKey)
erm… wat do i type in the userKey? and the function() is wat i want it to do rite? sry i am a new learner
userKey is an object that detects keypresses on your keyboard. the function is what it does when the spacebar is pressed.
so userKey= new object(); <— this i dont change it?