纳金网

标题: Draggable (Interactive Behavior) [打印本页]

作者: Asen    时间: 2011-10-15 10:53
标题: Draggable (Interactive Behavior)






               Draggable (Interactive Behavior)
              









           Summary
         

           Enables an object to be dragged by the mouse.
         





               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 2.10.1 of the 'Draggable' behavior, current as of 2005-Mar-21)
           

            Description
           


             The
            
              Horizontal Only
            
             and
            
              Vertical Only
            
             options for the
            
              Constrain Drag
            
             property causes the object to only be draggable in one direction (with respect to the screen).
            

             If
            
              Use Move Cursor?
            
             is checked, the cursor will be set when the mouse is over the object, and while dragging it. Which cursor is used depends on the
            
              Constrain Drag
            
             setting.
            

             The events for this behavior will fire on this behavior, and bubble to the parent object. You can use script to register event listeners on the parent object to track the various events.
            

             If
            
              Use Inertia?
            
             is checked, the object will keep moving when released at the same speed and direction as when released. It will then slow to a stop over a number of seconds, specified by the
            
              Inertia Stop Time
            
             setting.
            

             The
            
              Drag Target
            
             advanced property can be used to cause dragging one object to affect another. A common example is to attach the Draggable behavior to a titlebar for a window, and then specify the
            
              Drag Target
            
             as the group which holds all of the window. Dragging the title bar will move the entire group, but the user will not be able to drag the group by areas other than the title bar.
            

             In addition to constraining the drag (in screen coordinates) you can use the Range Watcher behavior to constrain the x/y/z coordinates to stay within a certain range.
            


            Basic Properties
           



              Constrain Drag
            

              Only permit the object to be dragged horizontally or vertically?
            

              Use Move Cursor?
            

              Show the Move cursor when the mouse is over the parent?
            

              Use Inertia?
            

              Cause the object to keep moving if you 'throw' it?
            



            Advanced Properties
           



              Inertia Stop Time
            

              If 'Use Inertia?' is checked, the number of seconds it takes for the object to slow to a stop.
            

              Drag Target
            

              Object to move when the parent of this behavior is dragged.
            

              Enable Immediately?
            

              Enable dragging immediately, or wait for the 'Enable' action to be called?
            



            Actions
           



              Enable
            

              Enables mouse dragging for the parent object.
            

              Disable
            

              Disable mouse dragging for the parent object.
            



            Events
           



              onDragStart
            

              Fires when the parent object starts being dragged.
            

              onDrag
            

              Fires every frame while the parent object is being dragged.
            

              onDragEnd
            

              Fires when the parent object stops being dragged.
            

              onInertia
            

              Fires when the parent object is moving due to intertia.
            

              onInertiaEnd
            

              Fires when the parent object stops being dragged, and no inertia is affecting the object.
            



            Demonstration
           




              View Demonstration Project
            




              Download Project File
            




作者: 奇    时间: 2012-5-27 23:20
凡系斑竹滴话要听;凡系朋友滴帖要顶

作者: tc    时间: 2012-5-30 23:18
“再次路过……”我造一个-----特别路过

作者: 菜刀吻电线    时间: 2012-7-9 23:27
无聊时可以刷屏幕 灌水 也可以试试 帖子的标题究竟可以写多长

作者: C.R.CAN    时间: 2012-8-24 23:31
先垫一块,再说鸟

作者: 晃晃    时间: 2013-1-29 23:27
既来之,则看之!

作者: glenndai    时间: 2014-3-11 13:27

好铁多多发,感激分享




欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5