我正在尝试删除我动态创建的电影剪辑,导出时出现错误
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(???));但没有成功。如何简单地删除导出时不存在的电影剪辑?