查看: 2820|回复: 9
打印 上一主题 下一主题

[Anark] Cancel Bubble (Interactive Behavior)

[复制链接]
Asen    

867

主题

0

听众

1万

积分

外协人员

Rank: 7Rank: 7Rank: 7

纳金币
17488
精华
1
跳转到指定楼层
楼主
发表于 2011-10-19 10:35:00 |只看该作者 |倒序浏览






               Cancel Bubble (Interactive Behavior)
              









           Summary
         

           Prevents a certain type of event from propogating to ancestor objects.
         





               Category
              


              Latest Behaviors
            




               Author
              


              Gavin Kistner
            




               Difficulty
              


              (Reference)
            




               Time to Complete
              


              5 Minutes
            








           Downloads
         


            Click Here
           
           to download the associated files.
         


            (This document covers version 1.0.1 of the 'Cancel Bubble' behavior, current as of 2005-Feb-11)
           

            Description
           


             When mouse events initiate for an object, by default they ‘bubble’ to the parent object, and then the grandparent, great-grandparent, (and so on) all the way up to the Scene.
            
            Sometimes, you may want to ‘catch’ the events for a child object and stop them from bubbling up. For example, assume you have the following scene:
            
             Scene
     Layer
        Robot Arm 1 Model
           Select on Click    (a behavior)
           Robot Arm 2 Model
              Select on Click (a behavior)
            

             The goal here is to allow either arm to be selected with the mouse. However, event bubbling means that if you click on
            
              Robot Arm 2 Model
            
             , the onMouseClick event will bubble up to
            
              Robot Arm 1 Model
            
             , causing it to also be selected.
            
            Attaching this behavior and setting
            
             Event to Catch
            
            to
            
             Mouse Click
            
            fixes the problem:
            
             Scene
     Layer
        Robot Arm 1 Model
           Select on Click    (a behavior)
           Cancel Bubble
           Robot Arm 2 Model
              Select on Click (a behavior)
              Cancel Bubble
            

             (Alternatively, you can modify your
            
              Select on Click
            
             behavior to return false at the end of its
            
              onMouseClick
            
             handler; this will also prevent the bubble from occurring.)
            

             Various other behaviors cancel bubbling for certain events, such as Selection Group, Focusable, Draggable, and Tumble.
            


            Basic Properties
           



              Event to Catch
            

              What event should be prevented from bubbling?
            



            Demonstration
           




              View Demonstration Project
            




              Download Project File
            



分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2012-2-1 23:21:25 |只看该作者
此地無銀。。。
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

板凳
发表于 2012-3-24 23:28:15 |只看该作者
水。。。
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

地板
发表于 2012-5-12 23:22:29 |只看该作者
我也来支持下
回复

使用道具 举报

   

671

主题

1

听众

3247

积分

中级设计师

Rank: 5Rank: 5

纳金币
324742
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

5#
发表于 2012-6-6 23:19:55 |只看该作者
已阵亡的 蝶 随 风 舞 说过  偶尔按一下 CTRL A 会发现 世界还有另一面
回复

使用道具 举报

462

主题

1

听众

31万

积分

首席设计师

Rank: 8Rank: 8

纳金币
2
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

6#
发表于 2012-6-18 23:18:56 |只看该作者
其实楼主所说的这些,俺支很少用!
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

7#
发表于 2012-7-28 23:21:32 |只看该作者
百度的叫度娘,网易的叫易娘,新浪内部还在为是叫新娘还是浪娘而争论不休!……不管你们是企鹅的额娘,豆瓣的伴娘,还是华为的伪娘,都要记得,淘宝才是你们的亲娘啊!亲!!
回复

使用道具 举报

   

671

主题

1

听众

3247

积分

中级设计师

Rank: 5Rank: 5

纳金币
324742
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

8#
发表于 2012-8-31 01:14:53 |只看该作者
都闪开,介个帖子,偶来顶
回复

使用道具 举报

1023

主题

3

听众

359

积分

设计实习生

Rank: 2

纳金币
335582
精华
0

最佳新人

9#
发表于 2012-9-4 23:22:31 |只看该作者
呵呵,很好,方便罗。
回复

使用道具 举报

tc    

5089

主题

1

听众

33万

积分

首席设计师

Rank: 8Rank: 8

纳金币
-1
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

10#
发表于 2013-3-18 23:20:33 |只看该作者
好`我顶``顶顶
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-9-24 22:29 , Processed in 0.217481 second(s), 29 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部