Groups | Blog | Home
all groups > flash actionscript > february 2004 >

flash actionscript : Urgency for work!! gravity v.s. array



cainarachi
2/17/2004 11:58:57 PM
have two movie clips in the stage with the instance name of bola1 and bola2
and i wanted to apply them some gravity

so i?ve put this code in the first frame of the stag
translation: bola = bal
gravidade = gravit
atrito = attritio
velocidade = velocit

var bola = new Array()
a=

for(i=1;i<3;i++)

a+
//bola="bola"+a;

bolax = "bola"+a

bolax.onEnterFrame = function()

velocidadey = 20;
chaotela = 400;
gravidade = 2;
atrito = .98;


this._y = this._y+velocidadey;

if (this._y-_height/2>chaotela) {
this._y = chaotela+_height/2;
velocidadey = -velocidadey;

}
velocidadey = velocidadey*atrito+gravidade;

}


but it don?t work

instead of using bolax or bola i use bola1 or bola2 the code work.
can someone help me
thanks
kglad
2/18/2004 1:35:24 AM
bolax is understood by flash to be a sting. therefore, bolax.onEnterFrame
makes no sense. in addition there's no bola3 and there's no reason to
repeatedly execute initializations in that enterFrame loop
to help flash resolve bolax into an object reference this[bolax]
AddThis Social Bookmark Button