Changing AS5 to MX - help please

Hi Everybody,
I found the following code some time ago, stored it in my AS file and promptly forgot about it - until now, problem is it don’t work in MX ( originally written for 5) and I cannot work out how to adjust it.

Code on Fr.1 of main timeline is :-

fish= 20;

Object.prototype.move = function () {
rotAdd = (random(100-(vita*rot))-50)/100;
rot += rotAdd;
_rotation += rot;
posX = this.tempo * Math.sin((_rotation/180)*Math.PI);
posY = -this.tempo * Math.cos((_rotation/180)*Math.PI);
_x += posX;
_y += posY;
if ((((_x < -20) or (_x > 550)) or (_y < -20)) or (_y > 500)) {
_rotation += 180;
}
};
for (i=0;i<fish;i++) {
attachMovie(“fish”, “fish” add i, i);
}
stop();

inside the library is an mc.fish with the linkage fish, code on mc.innerFish is -:

onClipEvent (load) {
tempo = random(3)+1;
vita = random(4)+2;
_x = random(500);
_y = random(500);
_rotation = random(360);
}
onClipEvent (enterFrame) {
move();
}

This code ( in 5 )produces 20 fish that glide around the stage quite gracefully and in a fishy type manner, however in MX it produces 20 fish that leap all over the place in a not so fishy manner. Any help greatly appreciated

Thanks

SteveD

I liked the last bit about the fishy stuff, very funny! :slight_smile:
(not making fun of you, just the fish…)
can you post the fla, easier to debug…?
normally, flash 5 code should work in MX…

*Originally posted by eyezberg *
**normally, flash 5 code should work in MX… **

not the gravity physics stuff something! There should be a tutorial about gravty or something that won’t owrk in FMX if I remember correctly!
btw …JOE :slight_smile: I like your footer! Very cool! Good you made it small so it’s very smooth!

Hi,
yep, heres the file in MX, you’ll see what I mean about non fishy movement

Cheers

SteveD

*Originally posted by Syko *
**not the gravity physics stuff something! **
Well, there’s a correction for Flash MX that explains why it didn’t work.

http://www.kirupa.com/developer/actionscript/spring2.asp

There’s a link to the original tutorial if you want to compare codes.

pom :crazy:

Hi ilyaslamasse,
Well that did the trick - or should I say this. did the trick.

Thanks for the pointer and thanks to eyezberg for responding

Cheers

SteveD

Haven’t helped much here…but learned a bit!
Thanks, pom!

Hey eyezberg
I’ve just seen that you live in Paris - whereabouts ?
I lived in the 20th for about 18 months before moving to a v.small town called Gérardmer ( which is where I live now) this is in the Vosges, I’m about 2hrs from Strasbourg and Metz in the other direction.
Probably the wrong thread for this type of chat ( well its hardly MX - is it) Just thought I’d ask.
Also responding to any thread on any foorum is always a help, it shows when asking Q.'s that someone else is actually interested. I’ve been working in Flash for about a year now, only consider myself at (lower) intermediary level but thanks to forums like these it gets better everyday

Thanks again

SteveD

Ahaha!! Un autre Français!

Je ne sais pas où habite Joe, mais moi je suis à 2 pas du 19ème et du 20ème.

pom :cowboy:

Non - je suis Anglais - and if you 2 are French your English is exceptional

SteveD

shweew… I took 5 years of french and I still needed babel for that lol

another reason why I dont live in Paris

Gotta love Babel :trout: