You want users to interact with your movie using their mouse.
Use the various mouse events to listen for mouse interactions on
display objects of type InteractiveObject. Use the read-only
mouseY properties from DisplayObject to examine the mouse location
relative to a display object, or the
localY properties from the MouseEvent passed to a mouse event
Basic mouse interaction can be created with the SimpleButton class, as described in Recipe 6.5. The SimpleButton class provides an easy way to create a clickable button with different button visual states: up, over, and down.
However, there are times when buttons just don’t provide enough interactivity. By listening to the various mouse events, you can create interesting interactive experiences. For instance, consider that you want to track the mouse cursor to create an interactive drawing program, drawing lines on-screen based on the user’s mouse movement. Or, consider that you have a maze that a user must navigate their mouse through without colliding with the walls to find the exit. Or, perhaps the user’s mouse movement needs to control the direction of a golf club, and the mouse button is used to swing.
These situations require use of the special InteractiveObject display object, which provides the ability to respond to the user’s mouse. If you go back to the introduction for this chapter, you’ll recall that the InteractiveObject class is a base ...