# If else statement the way to go?

**URL:** <https://forum.kirupa.com/t/if-else-statement-the-way-to-go/37334>\
**Category:** Uncategorized\
**Created:** [December 9, 2003, 2:00am UTC](https://forum.kirupa.com/t/if-else-statement-the-way-to-go/37334 "2003-12-09T02:00:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crapboyjr](https://avatars.discourse-cdn.com/v4/letter/c/bbe5ce/32.png) [@crapboyjr](https://forum.kirupa.com/u/crapboyjr)\
**Post date:** [December 9, 2003, 2:00am UTC](https://forum.kirupa.com/t/if-else-statement-the-way-to-go/37334/1 "2003-12-09T02:00:03Z")

</div>

Hello,

I have two movie clips. One is called btn1 and the other mc1.

Currently when I rollover btn1, mc1 moves 100.0 pixels from it’s current position. When I rollout, mc1 moves back to it’s original position. That’s fine.

What I want to do is when I rollover btn1 and then CLICK btn1, I want mc1 to remain at the 100.0 position.

I thinking this must be an if else statement, but I’m unclear about how to write the code. Below you’ll find the code that I have so far:

* * *

//set movie clip position

pan1 = mc1.\_x;

//code to control the easing of the movie clip

MovieClip.prototype.easeX = function(tX) {  
this.onEnterFrame = function() {  
this.\_x = tX-(tX-this.\_x)/1.2;  
if (this.\_x \>= tX-1 && this.\_x \<= tX+1) {  
delete this.onEnterFrame;  
}  
};  
};

//rollover

btn1.onRollOver = function() {  
mc1.easeX(100.0);

};

//rollout

btn1.onRollOut = function() {  
mc1.easeX(pan1);

};

//release. I don’t know what to do with this part.

btn1.onRelease = function() {  
\_root.footer.play();

};

* * *

Thanks to everyone who has made my actionscript learning less painful.
