Announcement

Collapse
No announcement yet.

[Solved] Scaleform Xbox360 Gamepad Problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Solved] Scaleform Xbox360 Gamepad Problem

    Hi everyone, I have problem with my Scaleform UI, i want to read the x and y values of the right stick of the Xbox 360 Gamepad but i can't have access to them, i've read the scaleform documentation but can't get it to work. There is a function called supportsAnalogEvents() which returns true if gamepad analog events are supported but it always returns false for me, you can find it here http://gameware.autodesk.com/documen...extensions.pdf.I also tried the AddCaptureKey method doesn't work either.
    My as3 test code :
    Code:
    import scaleform.gfx.Extensions;
    import scaleform.gfx.GamePad;
    import scaleform.gfx.GamePadAnalogEvent;
    
    Extensions.enabled = true;
    
    trace("Gamepad analog support : ",GamePad.supportsAnalogEvents());
    
    stage.addEventListener(GamePadAnalogEvent.CHANGE,GamepadHandler);
    
    function GamepadHandler(e:GamePadAnalogEvent):void{
    	trace("x_value : ",e.xvalue,"y_value :",e.yvalue);
    }
    EDIT

    I finally found a way to get the x and y values of the right stick in my ActionScript code. Since Scaleform GamePadAnalogEvents won't work, I get the right stick values from an Unrealscript function that I call in my Actionscript code. It's seems that we can't directly access those values from ActionScript so the only way i found is to get them from the playerInput class, and then put them into ActionScript variables.

    Example :

    Unrealscript
    Code:
    class MyGfxClass extends GFxMoviePlayer;
    
    function getRStickValues(GFxObject MyMC)
    {
        local vector2D RStick;
    
        RStick.x = GetPC().PlayerInput.RawJoyLookRight; // X Value [-1;1]
        RStick.y = GetPC().PlayerInput.RawJoyLookUp; // Y Value [-1;1]
        MyMC.SetFloat("R_StickX",RStick.x);
        MyMC.SetFloat("R_StickY",RStick.y);
    }
    ActionScript
    Code:
    import flash.external.ExternalInterface;
    
    var R_StickX:Number;
    var R_StickY:Number;
    
    function setRStickValues():void{
        ExternalInterface.call("getRStickValues",this);
    }

    #2
    Hey this is really cool! Thanks man Im gonna check this out and maybe use this.

    Comment


      #3
      I'm glad it helps you.

      If you want to use the ASCII values instead, here they are (if someone could add them to the documentation ) :

      Right Analog Stick Up : 112
      Right Analog Stick Down : 113
      Right Analog Stick Left : 114
      Right Analog Stick Right : 115

      Comment

      Working...
      X