开发者

AS3 click event added to stage but fires when clicking on a movieclick

开发者 https://www.devze.com 2023-03-06 22:02 出处:网络
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.

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 s开发者_运维技巧tage?

Thanks for any advice!


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
}


create layer at the bottom, add graphic that covers whole screen, convert it to symbol, add name to it and assign click event

0

精彩评论

暂无评论...
验证码 换一张
取 消