GamePadAnalogEvent Extensions

package scaleform.gfx
{
    import flash.events.Event;

   
    public final class GamePadAnalogEvent extends Event
    {
        public static const CHANGE:String   = "gamePadAnalogChange";

        public var code : uint  = 0;// See scaleform.gfx.GamePad for valid pad codes
        public var controllerIdx : uint = 0;
        public var xvalue : Number  = 0;// Normalized [-1, 1]
        public var yvalue : Number  = 0;// Normalized [-1, 1]

        public function GamePadAnalogEvent(bubbles:Boolean, cancelable:Boolean, 
                            code:uint, controllerIdx:uint = 0,   
                            xvalue:Number = 0, yvalue:Number = 0)
        {
            super(GamePadAnalogEvent.CHANGE, bubbles, cancelable);
            this.code = code;
            this.controllerIdx = controllerIdx;
            this.xvalue = xvalue;
            this.yvalue = yvalue;
        }
    }
}

This event is fired if Scaleform supports game pad analog events for a specific platform. It is only dispatched from the Stage and all listeners are expected to attach to the Stage object. The Scaleform FxPlayer framework fires these events with appropriate GamePad constants for the ‘code’ property, however developers may use other values (such as keyboard values) if necessary in their own integration of Scaleform. Example:

import scaleform.gfx.*;

trace(“GamePadAnalogEvents supported? “ + GamePad.supportsAnalogEvents());

function ev(e: GamePadAnalogEvent)
{
    trace("code = " + ev.code);
    trace("controllerIdx = " + ev.controllerIdx);
    trace("xvalue = " + ev.xvalue);
    trace("yvalue = " + ev.yvalue);
}
stage.addEventListener(GamePadAnalogEvent.CHANGE, ev);

code property

code : uint

Scaleform version: 4.0.13

Indicates which key/control was used to generate this event. The Scaleform FxPlayer framework will use game pad constants. See GamePad.

controllerIdx property

controllerIdx : uint

Scaleform version: 4.0.13

Indicates which keyboard/controller is used for the event (zero-based index).

xvalue property

xvalue : Number

Scaleform version: 4.0.13

Indicates the current value in the x-axis. The value will be normalized between -1 and 1, inclusive.

yvalue property

yvalue : Number

Scaleform version: 4.0.13

Indicates the current value in the y-axis. The value will be normalized between -1 and 1, inclusive.