I have a class FlexNativeWindow who extends to NativeWindow.
I use this method to create new window on my AIR app.
All works well but some keyboard interraction is not availaible.
For exemple focus arround textinput is not visible.
Key down and up don't work on DropDownList.
TabOrder doesn't work well!
Can you explain Why? Because I'm very desapointed!
Code to create the new window
var wdetcorr:wDetailCorrespondant = new wDetailCorrespondant();
wdetcorr.monIdCorresp =
correspDG.selectedItem.crIndex;
var wOptions:NativeWindowInitOptions = new
NativeWindowInitOptions();
wOptions.systemChrome =
NativeWindowSystemChrome.NONE;
wOptions.transparent = false;
var fnwDetailPatient:FlexNativeWindow = new
FlexNativeWindow(wdetcorr, wOptions);
fnwDetailPatient.active();
Code about my custom NativeWindow
package fr.int.ui.windowSkin
{
import flash.display.NativeWindow;
import flash.display.NativeWindowInitOptions;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import mx.core.IUIComponent;
import mx.core.IVisualElement;
import mx.core.IVisualElementContainer;
import mx.core.UIComponent;
import mx.events.*;
import mx.managers.WindowedSystemManager;
[Event(name="creationComplete", type="mx.events.FlexEvent")]
public class FlexNativeWindow extends NativeWindow implements
IFlexNativeWindow
{
private var _systemManager:WindowedSystemManager;
private var _content:UIComponent;
private var _window:IVisualElementContainer;
public function
FlexNativeWindow(window:IVisualElementContainer,
initOptions:NativeWindowInitOptions = null)
{
super(initOptions);
_window = window;
addEventListener(Event.ACTIVATE, windowActivateHandler);
}
public function addElement(control:IVisualElement):void
{
_window.addElement(control);
}
public function removeElement(control:IVisualElement):void
{
_window.removeElement(control);
}
private function windowActivateHandler(event:Event):void
{
event.preventDefault();
event.stopImmediatePropagation();
removeEventListener(Event.ACTIVATE,
windowActivateHandler);
if (stage)
{
if (!_systemManager)
_systemManager = new
WindowedSystemManager(IUIComponent(_window));
stage.addChild(_systemManager);
dispatchEvent(new
FlexEvent(FlexEvent.CREATION_COMPLETE));
stage.addEventListener(Event.RESIZE,
windowResizeHandler);
stage.addEventListener(KeyboardEvent.KEY_DOWN,
keyDownListener);
}
}
private function keyDownListener (e:KeyboardEvent):void {
if (e.keyCode == Keyboard.ESCAPE) {
stage.nativeWindow.dispatchEvent(new
Event("myEventClose", true));
stage.nativeWindow.close();
}
}
private function windowResizeHandler(event:Event):void
{
// prise en compte de la valeur mini
UIComponent(_window).height = stage.stageHeight;
UIComponent(_window).width = stage.stageWidth;
}
}
}