Reputation: 566
I have next application header:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()" creationPolicy="all" enterState="focusManager.setFocus(employeeIDTextInput);">
public function init():void {
focusManager.showFocusIndicator = true;
focusManager.showFocus();
focusManager.setFocus(theTextInput);
}
And theTextInput is on the default state. But when application starts theTextField is focused (a blue rectangle is around theTextField) but the cursor isn't inside theTextField. But in the next state I have anotherTextInput and when you switch between states both text inputs are focused correctly as you expect and the cursor appears inside every one of them correctly.
<mx:State name="secondState" enterState="{focusManager.setFocus(anotherTextInput)}">
My question is, Why when application starts the cursor isn't inside theTextInput as commanded on init() function?
Thank you for your answer
Upvotes: 2
Views: 2873
Reputation: 566
I solved it, That problem was because this is a component and is called from a main menu, and the creationComplete event is dispatched just in the moment when the menu is created just before the component appears in screen. What I did was to attach an event handler to show event and that is.
<mx:Canvas width="100%" height="100%" xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="init()" creationPolicy="all"
show="focusManager.setFocus(employeeIDTextInput)"
>
Thank you very much to every one who ask my question...
Upvotes: 2