• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Hour 15. ActionScripting Applications fo... > Making Drag-and-Drop Interactions

Making Drag-and-Drop Interactions

One of the most effective ways to give your users the power to interact is by letting them drag items around the Stage. It is essential for the creation of most games, and it's also a particularly effective teaching method because some people are “tactile” learners (whereas others might be visual or aural learners). For whatever reason, you may desire to let your users move items around the Stage. This is simple to do in Flash.

There's a slight dilemma, however. In Flash, the simplest way to determine when a user clicks a specific area involves the use of buttons. That's okay, because you'll be able to place a startDrag Action on a button instance. And because the startDrag Action requires you to specify (as a parameter) the instance name of the object you want to start dragging, you'll probably want to specify the button just clicked. (You can also give instance names to text objects and Movie Clips—so they can be dragged, too.) In many ways, the easiest object to drag is a button, but you do need to specify the button's instance name. (Although it's possible to use the mouse down clip event instead of a button with a mouse event, remember that the mouse down clip event is triggered when the user clicks anywhere—not just on the clip itself.)


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint