2010年6月16日 星期三

Flex: TextInput Focus issues

1. add a initial function on Flex app

mx:application initialize="onLoad(event)"

...

import flash.external.ExternalInterface;


private function onLoad(event:Event):void {
ExternalInterface.call('setBrowserFocus');
this.myCanvas.setFocus();

}


2. add javascript "setBrowserFocus ()" into index.template.html

function setBrowserFocus(){
document.getElementById('${application}').focus();
}


3. test again.

source: http://carrythezero.net/blog/2009/01/20/flex-textinput-focus-issues/

沒有留言: