Hi guys, I can’t figure out how to get the depth of event target Object…
My code looks like this:
private function createFooterItem(footerItem:XML):void {
[COLOR=gray] var button:Sprite = new Sprite();[/COLOR]
[COLOR=gray] button.graphics.beginFill(0xFF0000, 0);[/COLOR]
[COLOR=gray] button.graphics.drawRect(0, 0, 100, 50);[/COLOR]
[COLOR=gray] button.graphics.endFill();[/COLOR]
[COLOR=gray] button.buttonMode = true;[/COLOR]
button.addEventListener(MouseEvent.CLICK, clicked);
addChild(button);
}
private function clicked(e:MouseEvent):void {
trace(getChildIndex(e.currentTarget));
}
On the other hand… is it possible to assign a value to a sprite to pass it to other functions?
something like:
button.someValue = 100;
and then:
private function clicked(e:MouseEvent):void {
trace(button.someValue);
}