# \[FMX04\] Movement

**URL:** https://forum.kirupa.com/t/fmx04-movement/119351
**Category:** Uncategorized
**Created:** [August 13, 2004, 6:16pm UTC](https://forum.kirupa.com/t/fmx04-movement/119351 "2004-08-13T18:16:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Ectheo](https://avatars.discourse-cdn.com/v4/letter/e/7cd45c/32.png) [@Ectheo](https://forum.kirupa.com/u/Ectheo)
#### Post date: [August 13, 2004, 6:16pm UTC](https://forum.kirupa.com/t/fmx04-movement/119351/1 "2004-08-13T18:16:47Z")

</div>

Now, I was wondering: Is it possible to have this occur:

-User selects a button  
-a box slides over  
-when the user selects said button again, box slides back to original position

I was able to do this with motion tweening, but I keep reading about how you can do this in AS to keep it efficient. Any help would be appreciated.

---

<div class="post-metadata">

### Author: ![Voetsjoeba](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@Voetsjoeba](https://forum.kirupa.com/u/Voetsjoeba)
#### Post date: [August 13, 2004, 8:19pm UTC](https://forum.kirupa.com/t/fmx04-movement/119351/2 "2004-08-13T20:19:20Z")

</div>

Sure, all you’ve gotta do is swap onRollOver handler. The first thing that comes to my (clouded, since it’s late here) mind is using a flag to determine whether the mouse has already been over or not. Like this:

```auto

flag = 0;
theButton.onRollOver = function(){
if(flag){
//box slides back here
} else {
//box slides to the button here
}
flag = !flag;
}

```
