我想直接從用戶交互影片剪輯刪除兒童的,但它在說「所提供的索引超出範圍」 - 然而,因爲它沒有我必須失去了一些東西似乎任何事情都是超越界限的。這是我的代碼:閃光AS3提供的索引超出範圍
Circle.as:
for (var i=0; i<3;i++){ //this number should be based on the number of children found in the XML
var wedge:Wedge = new Wedge(wedgeHolderRef, i, cr,cScale);
}
Wedge.as:
public function Wedge(wedgeHolderRef, wedgeNum:int, cr:int = 3, cScale:int = 5)
{
var wedge:Sprite = new Sprite();
var wedgeClip:MovieClip = new MovieClip();
wedgeClip.addChild(wedge);
wedgeHolderRef.addChild(wedgeClip);
}
private function wedgeClickHandler(wedgeRef):void
{
var wedgeChildren = wedgeHolderRef.numChildren;
for (var i=0; i<wedgeChildren; i++)
{
var wedgeClip = wedgeHolderRef.getChildAt(i);
if (i != wedgeChildren-1){
} else {
deactivateCircle();
}
}
}
private function deactivateCircle()
{
var wedgeChildren = wedgeHolderRef.numChildren;
for (var i=0; i<wedgeChildren; i++){
//trace (i + "|" + wedgeHolderRef.getChildAt(i).wedgeNum);
wedgeHolderRef.removeChildAt(i); //Here is where I get the error
}
}
啊,當然。謝謝。 – mheavers