在我的文档类中,我生成了一堆动画片段,然后将它们放置在它们自己的类文件中。我想要发生的是,当我用鼠标触摸动画片段时,它们会被删除,并且得分数量会增加一个点。当触发鼠标事件时,如何从画布中删除特定的动画片段?继承人是我到目前为止已经试过,没有removeChild之或removeMovieClip工作:如何删除作为鼠标事件目标的动画片段?
public class Pong extends MovieClip
{
public var points:int=0;
public var timer:Timer=new Timer(100);
public function Pong()
{
// constructor code
timer.addEventListener(TimerEvent.TIMER, tick);
addEventListener(MouseEvent.MOUSE_OVER,score);
timer.start();
}
public function tick(TimerEvent)
{
var clikBloc:clik= new clik();
addChild(clikBloc);
}
public function score(evt:MouseEvent):int
{
trace(evt.target);
points++;
return (points);
removeChild(evt.target);
removeMovieClip(evt.target);
}
嘿,你是对的。不错的地方。 – Marty 2011-06-15 06:15:31