Hi I have a movieclip called soldierriver. Is can be moved around the stage by using the cursor keys. What I want is to prevent him from be moved off the stage. I know with drag and drop you use
startDrag(this,true,0,0,500,400);
But I don’t know how to add this into the code I am using for the cursor keys which is as follows.
onClipEvent(enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_root.soldierriver._x++;
}
if (Key.isDown(Key.LEFT)) {
_root.soldierriver._x--;
}
if (Key.isDown(Key.UP)) {
_root.soldierriver._y--;
}
if (Key.isDown(Key.DOWN)) {
_root.soldierriver._y++;
}
Can someone please tell me how to include it in my code?
Cheers
Lesley