I’m trying to combine these two tutorials:
http://www.kirupa.com/developer/actionscript/multiDimArrays_attach.htm
and random motion:
http://www.kirupa.com/developer/actionscript/random_motion.htm
but how?
I want the attached movies to float around but i just can’t.
Here is the code.
[Actionscript]
//Array with all our information
memberInfo = [[“Kirupa”, “Flashing (MX) complete strangers in 32-bit color.”, “http://www.kirupa.com/forum/member.php?u=1”], [“B.Rich”, “Basketball, Golf, Web Media.”, “http://www.kirupa.com/forum/member.php?u=4513”], [“Senocular”, “Fun stuff, like Flash”, “http://www.kirupa.com/forum/member.php?u=2867”]];
//Starting x & y values
var xPos = 150;
var yPos = 60;
//For loop to attach our container movieclip and pass the array information
for (i=0; i<memberInfo.length; i++) {
//attach the container clip
attachMovie(“container”, “new”+i, i, {_x:xPos, _y:yPos});
//onLoad = function() {
//data you may want to change
width = 300;
height = 200;
speed = Math.round(Math.random()*2)+1;
//initial positions
x = Math.random()*width;
y = Math.random()*height;
this[“new”+i]._x = x;
this["new"+i]._y = y;
x_new = Math.random()*width;
trace(x_new)
y_new = Math.random()*height;
//increase the y postion each time
//yPos += this["new"+i]._height+5;
//add the information
this["new"+i].name.text = memberInfo*[0];
this["new"+i].interest.text = memberInfo*[1];
this["new"+i].link = memberInfo*[2];
}
onEnterFrame = function() {
//x movement
trace(“ok”)
if (x_new > this[“new”+i]._x) {
sign_x = 1;
} else {
sign_x = -1;
}
trace(sign_x)
dx = Math.abs(x_new - this["new"+i]._x);
if ((dx>speed) || (dx<-speed)) {
this["new"+i]._x += sign_x*speed;
} else {
x_new = Math.random()*width;
}
//y movement
if (y_new > this["new"+i]._y) {
sign_y = 1;
} else {
sign_y = -1;
}
dy = Math.abs(y_new - this["new"+i]._y);
if ((dy>speed) || (dy<-speed)) {
this["new"+i]._y += sign_y*speed;
} else {
y_new = Math.random()*height;
}
}
[/Actionscript]
can anyone see what I have to do to get the attached movies moving around? please?..
file is attached.