我想刪除我動態創建的影片剪輯,當出口出現錯誤刪除動態添加的影片剪輯使用removeChild之(未定義的屬性錯誤)
1120:未定義的屬性player_mc的訪問
function addplayer(id:String):MovieClip {
var mcObj:Object=null;
mcObj=getDefinitionByName(id.toString());
return (new mcObj()) as MovieClip;
}
// this creates the mc
function startplayer():void {
var player_mc:MovieClip = addplayer("s"+station.value);
addChild(player_mc)
}
// this is supposed to remove it
function stopplayer():void {
//the following line causes the error
removeChild(player_mc);
}
正如你可以看到我使用addChild在我的庫中影片剪輯,這可能是庫項目與類名S1,S2,S3 ...
我嘗試使用removechild(getchildbyname(?????));沒有成功。我如何簡單地刪除導出時不存在的影片剪輯?