This works in IE:

 

window.onload = setFocusOnLoad;

function setFocusOnLoad(){

      ${swf}.focus();

}

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Robert Byrne
Sent: Friday, December 05, 2008 4:34 PM
To: [email protected]
Subject: RE: [flexcoders] txtbx focus at login

 

I'm looking into this now, but won't get back to it for a while:
http://www.igorcosta.org/?p=179

There also a bit about it here:
http://www.htmlforums.com/archive/index.php/t-64150.html

Thanks for the pointers.
-Robert


--- On Fri, 12/5/08, Tracy Spratt <[EMAIL PROTECTED]> wrote:

From: Tracy Spratt <[EMAIL PROTECTED]>
Subject: RE: [flexcoders] txtbx focus at login
To: [email protected]
Date: Friday, December 5, 2008, 3:35 PM

This is because the Flash Player instance itself (Object/Embed tag) does
not have the focus in the Browser.  There is a bit of javascript code
that will set the focus, but last I heard it only works in IE.  I can
find that script if it would be useful.

 

Tracy

 

________________________________

From: [email protected] [mailto: [email protected] ]
On Behalf Of Robert Byrne
Sent: Friday, December 05, 2008 1:25 PM
To: [email protected]
Subject: [flexcoders] txtbx focus at login

 

This is a bit odd.  When I first open the application, the focus IS set
on the login txtbx but when I start typing nothing happens.

If I tab to the password txtbx I can type.  If I tab back to the login,
I can type.

If I click anywhere on the flex app, not just in the login txtbx, I can
type.

I know the focus is on the login txtbx because there is an orange box
around it.  When tabbing to the password, the orange box moves to the
password.

I tried setting focus to the flash object in the html wrapper within a
window.onload event using both focus() and click().  Nothing.

Any ideas?
Thanks - Robert.

Here's some code:

MXML:

<mx:Label text="@Resource( key='loginId' , bundle='Labels' )"
fontWeight=" bold" width="60" />
<mx:TextInput id="usernameInput" width="140" />

AS:
override protected function init():void{
  super.init() ;
  this.logger. debug("init" );

  this.loginForm. defaultButton = this.loginButton;
  this.usernameInput. setFocus( );
}

 

 

 

Reply via email to