# Simple code request

**URL:** <https://forum.kirupa.com/t/simple-code-request/303270>\
**Category:** flash\
**Created:** [January 18, 2010, 3:56am UTC](https://forum.kirupa.com/t/simple-code-request/303270 "2010-01-18T03:56:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sbarton22](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/sbarton22/32/2204_2.png) [@Sbarton22](https://forum.kirupa.com/u/Sbarton22)\
**Post date:** [January 18, 2010, 3:56am UTC](https://forum.kirupa.com/t/simple-code-request/303270/1 "2010-01-18T03:56:33Z")

</div>

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!
