Hola Alvaro
no entiendo muy bien tu pregunta. Creo que quieres añadir 7 elementos al
escenario, pero quieres que sean distintos, aunque todos tienen que tener el
mismo comportamiento no?
Asi, tirando por lo sencillo puedes hacer dos cosas.
Opcion 1: El clip bola tiene varios estados (fotogramas) y cuando haces el
attach mandas cada instancia a un fotograma distinto. Por cierto tenias
codigo redundante antes, ball ya es una referencia a cada una de las
instancias, no hace falta que en cada ciclo del bucle vuelvas a posicionar
todas las bolas.
var numBalls:Number = 7;
var x_array:Array = [-250, -110, 110, 250, 200, 0, -200];
var y_array:Array = [10, 10, 10, 10, 10, 10, 10];
var z_array:Array = [-70, -250, -250, -70, 150, 250, 150];
for (var i:Number = 1; i<=numBalls; i++) {
var ball:MovieClip = attachMovie("ball", "ball" + i, i);
ball.gotoAndStop(i);
ball.x = x_array[i-1];
ball.y = y_array[i-1];
ball.z = z_array[i-1];
}
Opcion 2: Crear tantos clip en la biblioteca como bolas quieras adjuntar, y
a cada una darle un identificador de vinculacion diferente, ref_1, ref_2...
var numBalls:Number = 7;
var x_array:Array = [-250, -110, 110, 250, 200, 0, -200];
var y_array:Array = [10, 10, 10, 10, 10, 10, 10];
var z_array:Array = [-70, -250, -250, -70, 150, 250, 150];
for (var i:Number = 1; i<=numBalls; i++) {
var ball:MovieClip = attachMovie("ref_"+i, "ball" + i, i);
ball.x = x_array[i-1];
ball.y = y_array[i-1];
ball.z = z_array[i-1];
}
----- Original Message -----
From: "AL" <[EMAIL PROTECTED]>
To: "Lista dedicada a Actionscript" <[email protected]>
Sent: Friday, July 13, 2007 2:18 PM
Subject: Re: [ASNativos] intercambiar simbolos
Este es el codigo del bucle for, teniendo en cuenta que en la biblioteca
solo tengo un elemento que es ball....que puedo hacer?
for (var i:Number = 0; i<numBalls; i++) {
var ball:MovieClip = attachMovie("ball", "ball" + i, i);
ball.x = -250;
ball.y = 10;
ball.z = -70;
ball1.x = -250;
ball1.y = 10;
ball1.z = -70;
ball2.x = -110;
ball2.y = 10;
ball2.z = -250;
ball3.x = 110;
ball3.y = 10;
ball3.z = -250;
ball4.x = 250;
ball4.y = 10;
ball4.z = -70;
ball5.x = 200;
ball5.y = 10;
ball5.z = 150;
ball6.x = 0;
ball6.y = 10;
ball6.z = 250;
ball7.x = -200;
ball7.y = 10;
ball7.z = 150;
}
}
--
Alvaro Portela Cid
www.incubik.com
-----------------------------------------------------
ASNativos
www.5dms.com
subscripciones/desubscripciones
http://asnativos.5dms.com
-----------------------------------------------------
-----------------------------------------------------
ASNativos
www.5dms.com
subscripciones/desubscripciones
http://asnativos.5dms.com
-----------------------------------------------------