# \[ActionScript 2.0/MX\] Trouble with Flash 5 code compatibilty

**URL:** <https://forum.kirupa.com/t/actionscript-2-0-mx-trouble-with-flash-5-code-compatibilty/115314>\
**Category:** Uncategorized\
**Created:** [July 7, 2004, 5:48pm UTC](https://forum.kirupa.com/t/actionscript-2-0-mx-trouble-with-flash-5-code-compatibilty/115314 "2004-07-07T17:48:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![blue\_chi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/blue_chi/32/62_2.png) [@blue\_chi](https://forum.kirupa.com/u/blue_chi)\
**Post date:** [July 7, 2004, 5:48pm UTC](https://forum.kirupa.com/t/actionscript-2-0-mx-trouble-with-flash-5-code-compatibilty/115314/1 "2004-07-07T17:48:15Z")

</div>

Hello people, I read a tutorial here ages back (I can’t find it now) Anyway, it was about something different but I got this code from it and it works only when the SWF is exported in Flash 5 version.

```php
onClipEvent (enterFrame) {
	new_dest = _xmouse+_x;
	pos = _x;
	vel = ((dest-.1*pos)/9+vel*0.9);
	_x += vel;
	dest = new_dest-_x;
}

```

Where does the compatibilty problem lay? and How can we make it work on Flash MX or MX 2004?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 6:13pm UTC](https://forum.kirupa.com/t/actionscript-2-0-mx-trouble-with-flash-5-code-compatibilty/115314/2 "2004-07-07T18:13:25Z")

</div>

the problem is vel. Its used before its defined.  
[http://www.kirupa.com/developer/oop2/AS2OOPChangedAndAdded2.htm](http://www.kirupa.com/developer/oop2/AS2OOPChangedAndAdded2.htm) (#2)  
you’ll just need to give it a default value in an onClipEvent(load) - something like 0. (Seems you need to with dest too)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 6:49pm UTC](https://forum.kirupa.com/t/actionscript-2-0-mx-trouble-with-flash-5-code-compatibilty/115314/3 "2004-07-07T18:49:51Z")

</div>

Thanks on the fast reply senocular, but that doesn’t explain why it doesnt work in Flash MX either…

I will try defining the codes and then I will come back to you. Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 6:50pm UTC](https://forum.kirupa.com/t/actionscript-2-0-mx-trouble-with-flash-5-code-compatibilty/115314/4 "2004-07-07T18:50:28Z")

</div>

> [@blue\_chi](#):
>
> Thanks on the fast reply senocular, but that doesn’t explain why it doesnt work in Flash MX either.

yes, it does.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 8:20pm UTC](https://forum.kirupa.com/t/actionscript-2-0-mx-trouble-with-flash-5-code-compatibilty/115314/5 "2004-07-07T20:20:49Z")

</div>

It is working! Thanks so much senocular!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 7, 2004, 8:22pm UTC](https://forum.kirupa.com/t/actionscript-2-0-mx-trouble-with-flash-5-code-compatibilty/115314/6 "2004-07-07T20:22:28Z")

</div>

welcome 🙂
