我想删除我动态创建的影片剪辑,当出口出现错误删除动态添加的影片剪辑使用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(?????));没有成功。我如何简单地删除导出时不存在的影片剪辑?