Chapter 3. Working with Drag-and-drop Interactions

In this chapter, we will go through the basic events and callbacks of CreateJS to make a drag-and-drop feature. After reading this chapter, you will be able to understand common events of objects in CreateJS and also how to change properties such as width or height. We will cover the following topics in this chapter:

  • Scenarios for drag-and-drop
  • Mouse events
  • Creating an example to drag-and-drop

The scenario

All we need to do to create a drag-and-drop feature is to bind events to DisplayObject on the Stage object (such as a circle) and then change the x and y axes of the target object continuously as the mouse is moved. Fortunately, CreateJS provides many events on mouseover, and we can use them to achieve our goals.

In further sections, we will see how we can bind events to objects and get information from the mouse cursor. We will also see how to change the properties of an object or shape in the Stage object.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.253.198