From Gnash Project Wiki

Jump to: navigation, search

Sprites and onMouseUp,Down,Move events

The following user-defined (and maybe "clip") mouse events handlers are received by sprites indipendently of mouse position:

  • onMouseUp
  • onMouseDown
  • onMouseMove

For a sprite, it is not needed to use Mouse.addListener in order to receive those events and it is not possible to use Mouse.removeListener to stop events from being received.

IFF Mouse.addListener() is used, then the events will be notified twice ! Back to once only if Movie.removeListener() is called.

NOTE that the event handler can be found anywhere in the inheritance chain. For example, setting MovieClip.prototype.onMouseMove will send the event to any movieclip.

Sprites and mouse entity events

A "Mouse entity" is a character that react to mouse pointer hitting it's visinble shape. When the pointer is over a "mouse entity" it is usually changed into an hand cursor.

Events that turn a sprite into a "mouse entity" are:

  • onPress
  • onRelease
  • onRollOver
  • onRollOut
  • onDragOver
  • onDragOut

onReleaseOutside is not an event that turns the sprite into a mouse entity. No matter what you assign to these members, the character turns into an 'active' one. Also works if you assign 'undefined' to it (not the string, the actual undefined value). The only way to remove the 'active' status from a sprite is by *deleting* any property with that name.

Sprite states

A sprite can be a mouse entity or not (thus the can_handle_mouse_event should return true or false) depending on the events defined for it, either statically or dynamically.

Events triggering state change NonListener -> Listener

  1. mouse clip event specified for the character being placed
  2. a user defined mouse event handler is specified for any object in the inheritance chain

Events triggering state change Listener -> NonListener:

  1. all user defined mouse event handlers are deleted from any object in the inheritance chain *and* no mouse clip event was speficied