as 2 to as 3 help with one part of very short code!

By jcrossno | Jan 8, 2009

actionscript3

Hello,
I need help converting this from as2 to as3. here is code

attachMovie should be addchild()
_x should be just x

I cant figure out what t.dx should convert to.

for(i=0;i<25;i++) {//number of instances

var t = this.attachMovie("dstream","dstream"+i,i);
t._x = Math.random()*1000;
t._y = Math.random()*1000;
t.dx = Math.round(Math.random()*1000);//destination coordinates
t.dy = Math.round(Math.random()*1000);
t._xscale = Math.random()*150+40;//scale of object
t._yscale = t._xscale;
t.onEnterFrame = mover;
}

function mover() {
this._x += (this.dx-this._x)/100;//easing of motion
this._y += (this.dy-this._y)/10;//easing of motion
if(Math.round(this._x) == this.dx) {
this.dx = Math.round(Math.random()*775);
this.dy = Math.round(Math.random()*600);
}
}

any help would be much appreciated!
thanks,

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0