Reads input of the joystick and fires events.
Syntax
joystick.read()
Parameters
Returns
Nothing
Example
var x = DirectX.joysticks;
for (i = 0; i < x.length; i++)
{
trace(x[i].name);
trace(x[i].guid);
}
joy = [];
joy[0] = new Joystick(x[0].guid);
joy[1] = new Joystick(x[1].guid);
trace(joy[0].buttons);
joy[0].onLeft = function ()
{
trace("left");
}
joy[0].onUp = function ()
{
trace("up");
}
joy[0].onRight = function ()
{
trace("right");
}
joy[0].onDown = function ()
{
trace("down");
}
joy[0].onPress = joy[1].onPress = function (n)
{
trace(n);
}
function readJoystick()
{
joy[0].read();
joy[1].read();
}
Application.setInterval(readJoystick, 50);