AS3 click事件添加到阶段,但在movieclick当点击火灾 [英] AS3 click event added to stage but fires when clicking on a movieclick

查看:98
本文介绍了AS3 click事件添加到阶段,但在movieclick当点击火灾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个AS3新手!我添加了一个click事件的阶段,但这一事件也触发,当我点击舞台上的影片剪辑。

i am a as3 newbie! I added a click event to the stage but this event also fires when i'm clicking a movieclip on the stage.

我怎样才能使这个事件只火,如果我点击直接在舞台上?

How can i make this event fire only if i click directly on the stage?

感谢您的任何意见!

推荐答案

。您可以检查你的函数是什么点击的目标是通过检查事件的currentTarget。

because of event bubbeling every click will also fire an stage click event. You can check in your function what the clicked target was by checking the currentTarget of the event.

if(e.currentTarget == stage){
     //do your stuff
}

这篇关于AS3 click事件添加到阶段,但在movieclick当点击火灾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆