# Random Movement in Flash MX

**URL:** <https://forum.kirupa.com/t/random-movement-in-flash-mx/2761>\
**Category:** programming\
**Created:** [April 17, 2002, 10:05pm UTC](https://forum.kirupa.com/t/random-movement-in-flash-mx/2761 "2002-04-17T22:05:44Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [April 17, 2002, 10:05pm UTC](https://forum.kirupa.com/t/random-movement-in-flash-mx/2761/1 "2002-04-17T22:05:44Z")

</div>

I took the random motion tutorial, and everything works fine when I export from Flash MX as a Flash 5 file. If I try to export as a Flash 6 file, then the random motion doesn’t happen. What’s up with this? I’d use Flash 5, but I need some capabilities you can only find in Flash 6 for the project im doing right now.\r\rAny help would be appreciated.\r\rThanks!\rDavid Balatero

---

<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:** [April 17, 2002, 10:24pm UTC](https://forum.kirupa.com/t/random-movement-in-flash-mx/2761/2 "2002-04-17T22:24:42Z")

</div>

the problem is in the methods.\r\rflash 5 used to look through the calling object’s namespace by default, so references to local variables and properties could be left withou a prefix. ie \_x would refer to the movie that’s calling the function’s x position.\r\rflash mx doesn’t do that (much to my dismay). now the method seems to look at it’s own namespace instead, which is usually the prototype chain of whatever object it’s an extension of. to get to the calling movie’s namespace, use “this”.\r\ryou need to go through the code and add “this.” before every local reference.\r\rthere may be other things, but i think that’s the big one.

---

<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:** [April 18, 2002, 12:25am UTC](https://forum.kirupa.com/t/random-movement-in-flash-mx/2761/3 "2002-04-18T00:25:23Z")

</div>

Which ones are local references? I’m a good programmer, but new to ActionScript (I’ve done mostly PHP and Perl), and am still trying to get the rules down pat…

---

<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:** [April 18, 2002, 4:03pm UTC](https://forum.kirupa.com/t/random-movement-in-flash-mx/2761/4 "2002-04-18T16:03:52Z")

</div>

i’m using the wrong words. sorry about that. ; )\r\rby local, i meant anything in the methods pertaining to the movie that’s calling it:

```auto
 \r\rMovieClip.prototype.move = function(){\r\r var spd = _root.speed; // not pertaining to the calling movie\r\r _x += spd; // this line needs to read: this._x += spd;\r\r}

```

\rnow that i think about it, local would better describe variables that exist in the function itself, such as “spd” in the above ficticious function.
