Hi guys,
I have a problem. I’m still learning the basics of Flash, so this will seem pretty trivial to most of you, but I would really appreciate some help with this.
I tried using setChildIndex on event.currentTarget, but it doesn’t seem to work. I can’t decipher the error that pops up.
This is the entire code:
for(var i:int=0;i<10;i++){ //Sphere worm
var Circle:BlueSphere = new BlueSphere();
Circle.x = 40*i+50;
Circle.y = 200;
Circle.scaleX = i*.4;
Circle.scaleY = i*.4;
Circle.buttonMode = true;
Circle.pos = i;
Circle.addEventListener(MouseEvent.CLICK,clickCircle);
function clickCircle(event:MouseEvent){
event.currentTarget.y += 10;
setChildIndex(event.currentTarget,0);
trace("You clicked " + event.currentTarget + " " + event.currentTarget.pos + "!");
}
addChild(Circle);
}
This is the error::
1118: Implicit coercion of a value with static type Object to a possibly unrelated type flash.display:DisplayObject.
It refers to this:
setChildIndex(event.currentTarget,0);
Thanks for reading this. Any help would be greatly appreciated!