When i assign z position a value to a movieclip through its class constructor the movieclip does not display anymore. If i assign it later like in the tween it stops moving.
here is the code im using
Code:
package
{
import flash.display.MovieClip;
import flash.events.*;
import com.gskinner.motion.*;
public class BackgroundCircle extends MovieClip
{
public var radius:Number;
private var moveTween:GTween;
public function BackgroundCircle(r:Number, newX:Number, newY:Number)
{
radius=r;
height=0;
width=0;
x=newX;
y=newY;
//Hides the movieclip
z=Math.random()*1;
moveTween = new GTween(this, 1, {height:r, width:r});
moveTween.addEventListener(Event.COMPLETE, move);
}
public function move(e:Event)
{
var newX:Number=radius+Math.random()*(stage.stageWidth-radius*2);
var newY:Number=radius+Math.random()*(stage.stageHeight-radius*2);
var newZ:Number=-500+Math.random()*3000;
//Stops moving the movieclip at all.
moveTween = new GTween(this, 1, {x:newX, y:newY, z:newZ});
moveTween.addEventListener(Event.COMPLETE, move);
}
}
}