GameInput.DEVICE_ADDED not getting called
why gameinput device_added never called on ouya air application?
i have made static. gameinput.issupported true , gameinput.numdevices 1. there other possibilities?
public static var gameinput:gameinput;
private static var _device:gameinputdevice;
public function gamecontroller(stage:movieclip)
{
this.stage = stage;
stage.stage.addeventlistener(event.enter_frame, onframe);
stage.stage.addeventlistener(keyboardevent.key_down, onkey);
stage.stage.addeventlistener(keyboardevent.key_up, onkeyup);
main.trace("" + gameinput.issupported);
main.trace("" + gameinput.numdevices);
gameinput = new gameinput();
gameinput.addeventlistener(gameinputevent.device_added, handledeviceattached);
//gameinput.addeventlistener(gameinputevent.device_removed, handledeviceremovedevent);
keyboardcontroller = new keyboardcontroller();
}
protected static function handledeviceattached(e:gameinputevent):void
{
main.trace("device added\n");
gameinputcontrolname.initialize(e.device);
for(var k:number=0;k<gameinput.numdevices;k++){
_device = gameinput.getdeviceat(k);
var _controls:vector.<string> = new vector.<string>;
_device.enabled = true;
for (var i:number = 0; < _device.numcontrols; i++) {
var control:gameinputcontrol = _device.getcontrolat(i);
control.addeventlistener(event.change,onchange);
_controls[i] = control.id;
}
_device.startcachingsamples(30, _controls);
}
for(var j:int=0; j<_controls.length; j++)
{
main.trace(""+_controls[j]);
}
//stage.addeventlistener(event.enter_frame, getcachedsamples);
}
protected static function onchange(event:event):void
{
var control:gameinputcontrol = event.target gameinputcontrol;
main.trace("" + control.name);
main.trace("" + control.value);
}
thanks!
chris
could please share platform, os version using. have attached .apk @ https://www.dropbox.com/sh/0e4tef1wh1zdhlj/xozqlrnjje , sample project using gameinputevent.device_added listener, can give try once , see if resolve issue.
regards,
nimit
More discussions in AIR Beta Channel
adobe
Comments
Post a Comment