Random Movement in Flash MX

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

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.

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…

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:

 \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.