当在点击事件中,用edit工具移动图片(Picture Maker)的时候,我们会得到event的target是CustomSprite对象,而在event的target对象如下
如下即可
private function activateEditTool(event:MouseEvent):void
{
if (event.target is Graphic)
{
myEditTool.activate(EditTool.MOVE, [ Graphic(event.target)]);
}
}
protected function myGraphicsLayer_graphicAddHandler(event:GraphicEve nt):void
{
event.graphic.addEventListener(MouseEvent.CLICK, activateEditTool);
}
如下即可
if(event.target is Graphic || event.target.parent is Graphic)