# OOP Movement

**URL:** <https://forum.kirupa.com/t/oop-movement/264188>\
**Category:** flash\
**Created:** [June 23, 2008, 8:51pm UTC](https://forum.kirupa.com/t/oop-movement/264188 "2008-06-23T20:51:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Squib](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@Squib](https://forum.kirupa.com/u/Squib)\
**Post date:** [June 23, 2008, 8:51pm UTC](https://forum.kirupa.com/t/oop-movement/264188/1 "2008-06-23T20:51:57Z")

</div>

Hi all, I’m wondering if someone could give me any pointers?

I’m in the process of wrestling with OOP. (And its proving pretty tough going!). What i would like to know is how exactly I can add movement to the objects I’ve added to the stage? I tried to add rollover/rollout events (which I’ve commented out) but it just threw up error messages??

What I’d eventually like to do is incorporate the TweenMax class (which rocks!) into it, maybe move the button or increase the scale, so any help would be fantastic!

You can find what I’ve got so far [here](http://drop.rbplimited.co.uk/OOPMovement.zip)

Any help would be great,  
Cheers,  
Squibn

---

<div class="post-metadata">

**Author:** ![krilnon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/krilnon/32/34_2.png) [@krilnon](https://forum.kirupa.com/u/krilnon)\
**Post date:** [June 24, 2008, 4:08am UTC](https://forum.kirupa.com/t/oop-movement/264188/2 "2008-06-24T04:08:34Z")

</div>

If you move the following two lines to line 21 (or anywhere after _btn1_ is created in that function), then your event handlers will work properly:

```auto
btn1.addEventListener(MouseEvent.MOUSE_OVER, onFolderOver);
btn1.addEventListener(MouseEvent.MOUSE_OUT, onFolderOut);

```

Those lines didn’t work before because they were in the class initialization function (which runs before the constructor) and because you were outside of the scope in which _btn1_ was defined.

---

<div class="post-metadata">

**Author:** ![Squib](https://avatars.discourse-cdn.com/v4/letter/s/ebca7d/32.png) [@Squib](https://forum.kirupa.com/u/Squib)\
**Post date:** [June 24, 2008, 8:02am UTC](https://forum.kirupa.com/t/oop-movement/264188/3 "2008-06-24T08:02:55Z")

</div>

Ahhhh! That makes sense. Thanks a million Krilnon,  
I can see this OOP stuffs gonna be heavy going!
