package scaleform.gfx { import flash.events.MouseEvent; public final class MouseEventEx extends MouseEvent { public var mouseIdx : uint = 0; public var nestingIdx : uint = 0; public var buttonIdx : uint = 0; // LEFT_BUTTON, RIGHT_BUTTON, ... public static const LEFT_BUTTON : uint = 0; public static const RIGHT_BUTTON : uint = 1; public static const MIDDLE_BUTTON : uint = 2; public function MouseEventEx(type:String) { super(type); } } }
This event is an extension of the standard flash.events.MouseEvent. It adds properties for multi-controllers and right/middle mouse buttons support. When Extensions.enabled property is set to true Scaleform always generates MouseEventEx events instead of standard MouseEvent. A user can check if the received event is an instance of the MouseEventEx and if so cast the event object to the extension type. Example:
import scaleform.gfx.*; Extensions.enabled = true; stage.doubleClickEnabled = true; function ev(e:MouseEvent):void { trace("!!!! EVENT. " + cnt++); trace("eventType = "+e.type); trace("bubbles = "+e.bubbles); trace("eventPhase= "+e.eventPhase); trace("target= "+e.target.name); trace("currentTarget = "+e.currentTarget.name); if (e is MouseEventEx) { var ee:MouseEventEx = e as MouseEventEx; trace("mouseIdx = "+ee.mouseIdx); trace("nestingIdx= "+ee. nestingIdx); trace("buttonIdx = "+ee.buttonIdx); } trace(e); } stage.addEventListener(MouseEvent.MOUSE_DOWN, ev); stage.addEventListener(MouseEvent.MOUSE_UP, ev); stage.addEventListener(MouseEvent.CLICK, ev); stage.addEventListener(MouseEvent.DOUBLE_CLICK, ev);
Note: Once extensions are enabled, the mouse event will be fired for right, middle, center, etc mouse button events and user must check the buttonIdx property to figure out which button generated the event.
buttonIdx property
bbuttonIdx : uint [read]
Scaleform version: 4.0.13
Indicates for which button the event is generated (zero-based index). The value can be one of the following:
mouseIdx property
mouseIdx : uint [read]
Scaleform version: 4.0.13
Indicates for which mouse/controller the event is generated (zero-based index).
nestingIdx property
nestingIdx : uint [read]
Scaleform version: 4.0.13
This property is optional for rollOver/Out, mouseOver/Out and dragOver/Out events. This parameter specifies the index of nested rollover/dragover event over the same character.
When nested rollOver/rollOut, mouseOver/Out and dragOver/dragOut events are generated (separately for each mouse cursor) then this parameter represents the zero-based index of nesting: the initial event will have 0 as the parameter; if the second cursor rolls over the same character, then the second rollOver/rollOut event will be fired with the member set to 1. If any of the cursors leaves the character then the rollOut/mouseOut/dragOut will be fired with the member set to 1; the last rollOut/mouseOut/dragOut event will be fired with the member set to 0.