我有一个名为 button1 的影片剪辑,在这个影片剪辑中 有一个名为txt的动态文本
public function mouse_down(event:MouseEvent)
{
if(event.target==button1)
{
...//this only recognizes when i click the button without intersecting the dynamic text area
}
if(event.target==button1||event.target==button1.txt)
{
...//this works
}
我想知道如果我不指定它为什么不能识别在包含动态点击的区域中进行的点击,因为 txt 是 button1 的一部分,所以通常我只需要检查目标是否是 button1 但它不起作用:我还必须检查目标是否是 button1.txt
感谢您的帮助!
最佳答案
event.target
始终指向事件起源的对象,即使它嵌套在您添加监听器的对象中。请改用 event.currentTarget
。
查看 this blog post了解更多。
关于actionscript-3 - ActionScript 3 event.target,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9027619/