Skip to main content
Known Participant
February 4, 2014
Question

StageWebView arrow keys in Native Browser

  • February 4, 2014
  • 2 replies
  • 352 views

I have an air app for desktop. In the app I simply load a stageWebView and set the native browser boolean to true. I then load a url into the web view.

import flash.media.StageWebView;

import flash.geom.Rectangle;

var webView:StageWebView = new StageWebView(true);

webView.stage = this.stage;

webView.viewPort = new Rectangle(0,0,stage.stageWidth,stage.stageHeight);

webView.loadURL('http://www.argonautdesign.net/test.html');

The website simply alerts the keydown:

<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>

<script>

$(document).keydown(function(e)

{

          alert(e.which);

});

</script>

My goal is to detect arrow keys.

This application works great on OSX but does not work on Windows (again tracking arrow keys). If I set native browser option to false it does work. I just need the native browser for other reasons. Now if I go to the url directly from any of my browsers it also works fine. The problem is only within the app using the native browser option on windows. Any ideas how to detect arrow presses?

i'm using air 4.0.0.1390

This topic has been closed for replies.

2 replies

Known Participant
February 4, 2014

Even if there is away to steal the focus back from the stagewebview would be fine. I could do my arrow clicks in actionscript to javascript. Is there a way to do this without having to click off stagewebview?

Known Participant
February 4, 2014

It looks like arrow keys don't work on any website. Even moving through input text. The only way that arrow keys seem to work in this scenario is for scroll bars. (ps e.preventDefault() doesn't help either). Anyone have a work around for this?