Flash 4 To Flash 5 Nightmare!

I got some code i used for flash 4 which makes these balls in my background move around and when they collide they bounce off each other and the walls. But when i try to publish it in flash 5, it’s not compatible. Would anyone mind looking at the code and telling me if there’s anything I can do to make it compatible with flash 5??? :slight_smile:

Here it goes.
The first frame within my movieclip has the actions

tellTarget (“color”) {
gotoAndStop (getProperty("…/", _name));
}

I doubt this is what is causing the problem.

the 2nd frame within my movieclip has the actions

// ----------------------------------------------
// start move
// ----------------------------------------------
my_radius = (getProperty("", _width)/2);
// ‘n’ is always ‘name’ of circle.
my_x = getProperty("", _x);
my_y = getProperty("", _y);
my_n = getProperty("", _name);
if (Number(ymov) == Number("")) {
// *********************************
// ----------------------------------------------
// first run through code,
// this will initialize circle
// ----------------------------------------------
// *********************************
// pick a distance:
ymov = Number(random(/:speed))+1;
xmov = Number(random(/:speed))+1;
//
// pick a direction:
ysign = random(2)-1;
if (Number(ysign) == 0) {
ysign = 1;
}
xsign = random(2)-1;
if (Number(xsign) == 0) {
xsign = 1;
}
// adjust x and y movement
xmov = xmovxsign;
ymov = ymov
ysign;
// ----------------------------------------------
}
// *********************************
// ----------------------------------------------
// check edges
// ----------------------------------------------
if (Number(my_x)<=Number(Number(my_radius)+Number(/:speed))) {
xmov = xmov*-1;
my_x = Number(my_radius)+Number(/:speed);
}
if (Number(my_y)<=Number(Number(my_radius)+Number(/:speed))) {
ymov = ymov*-1;
my_y = Number(my_radius)+Number(/:speed);
}
if (Number(my_x)>=Number(/:movie_width-my_radius-/:speed)) {
xmov = xmov*-1;
my_x = /:movie_width-my_radius-/:speed;
}
if (Number(my_y)>=Number(/:movie_height-my_radius-/:speed)) {
ymov = ymov*-1;
my_y = /:movie_height-my_radius-/:speed;
}
// ----------------------------------------------
// check for collision
// ----------------------------------------------
n = 1;
// start checking for collisions
while (Number(n)<=Number(/:total_circles)) {
// don’t check myself
if (n ne my_n) {
n_x = getProperty("…/" add n,_x);
n_y = getProperty("…/" add n,_y);
n_radius = (getProperty ("…/" add n, _width) / 2);
delta_x = (Number(my_x)+Number(xmov))-(n_x);
delta_y = (Number(my_y)+Number(ymov))-(n_y);
if (Number((Number(delta_xdelta_x)+Number(delta_ydelta_y)))<Number(((Number(my_radius)+Number(n_radius))*(Number(my_radius)+Number(n_radius))))) {
// ----------------------------------------------
// handle collisions
// ----------------------------------------------
// I collided with circle ‘n’.
nx = eval("…/" add n add “:x mov”);
ny = eval("…/" add n add “:ymov”);
// swap travel values with it.
tempx = xmov;
xmov = nx;
set ("…/" add n add “:x mov”, tempx);
tempy = ymov;
ymov = ny;
set ("…/" add n add “:ymov”, tempy);
set ("…/" add n add “:collision”, my_n);
} else {
}
}
n = Number(n)+1;
}
// ----------------------------------------------
// move me
// ----------------------------------------------
setProperty ("", _x, Number(my_x)+Number(xmov));
setProperty ("", _y, Number(my_y)+Number(ymov));
// ----------------------------------------------

i’m betting this is where there’s going to be some issues.

The last frame contains this :

gotoAndPlay (_currentframe-1);

Outside in the main timeline these are the actions

total_circles = 5;
movie_width = 750;
movie_height = 550;
speed = 11;

I’ll be really impressed if someone can tell me how to fix my problem :slight_smile: You must be a ActionScript god! :slight_smile: Thanks in advance
-Jon

ps: I can send you my .FLA if you think it’ll be easier.

I think this is a job for Suprabeener :slight_smile:

I tried taking a look, but I have to admit that flash4.0 scripting was never my specialty, and now it just looks like greek to me.