我在舞台上有两个按钮,在彼此的顶部。我试图使用 setChildindex 以便当我按下打开按钮时,关闭按钮将出现在它的顶部。反之亦然。但我不断收到这个错误,我似乎无法理解。
Track On ArgumentError:错误 #2025:提供的 DisplayObject 必须是调用者的子对象。在 flash.display::DisplayObjectContainer/setChildIndex() 在 com.audio::Sequencer/trackOn1()
private var trackOnOff:Boolean = true;
this.track1.trackOn1.addEventListener(MouseEvent.CLICK, trackOn1);
this.track1.trackOff1.addEventListener(MouseEvent.CLICK, trackOff1);
public function trackOn1(event:MouseEvent = null):void
{
trace("Track On")
this.setChildIndex(this.track1.trackOff1, this.numChildren - 1);
trackOnOff = true;
}
public function trackOff1(event:MouseEvent = null):void
{
trace("Track Off")
this.setChildIndex(this.track1.trackOn1, this.numChildren - 1);
trackOnOff = false;
}
请帮忙。