I am just restarting my flash adventures and am trying to learn AS3.
I can a real quick code request. I am trying to make a MC bounce off the sides of the stage.
When I use the following code, the MC gets stuck going -2 then +2 at the edge of the stage.
addEventListener(Event.ENTER_FRAME, starMove);
function starMove(e:Event):void {
if (star_mc.x<stage.stageWidth-33) {
star_mc.x+=2
} else {
star_mc.x-=2
}
}
How do I get it disregard the first part of the if/else and then go the other direction?
I know this is a really beginer question, but it would really help me out.
Thanks!