When I'm changing the focus in my app using the setFocus() method,
the focus is changing to the TextInput that I'm trying to change it
to, but the cursor is blinking in the TextInput that's next in the
tabIndex. In other words, the cursor and focus are not staying together.
I have a TextInput called "inputZIPCode" and when the user tabs out
(focusOut event) it's checking to see that the ZIP code is valid,
then it looks up the Zip Code in a table to automatically fill in the
"inputCity" and "inputState" TextInput boxes. It *does* successfully do this.
Then I want the focus to go to "inputPhone1" (the box after
"inputCity" and "inputState" which is where the focus is going -- but
the cursor is blinking in the "inputCity" box. If I type on the
keyboard at that point, the input is going to the "inputCity" field,
not the "inputPhone1" field that is highlighted blue (has the
focus). If I hit the TAB key, both the focus and the cursor jump to
the box that's after "inputPhone1" in the tabIndex order. I have to
tab forward, then backwards to get both the focus and the cursor to
be in the proper "inputPhone1" box.
So why are the focus and the cursor not staying together?
Here's a snippet of my code:
-------------------------------------------
<mx:Script>
<![CDATA[
private function lookupZIPCode():void {
// Here is where the ZIP code is looked up,
// and the 'inputCity' and 'inputState'
TextInputs are filled
inputPhone1.setFocus();
}
private function invalidZIPCodeHandler():void {
//This clears the invalid code entered in
'inputZIPCode' and returns focus to same,
//thus preventing the user from moving on
until they've entered a valid ZIP.
inputZIPCode.text = ""
inputZIPCode.setFocus();
}
]]>
</mx:Script>
<mx:ZipCodeValidator id="zipV" source="{inputZIPCode}"
property="text" domain="US or Canada"
trigger="{inputZIPCode}"
triggerEvent="focusOut" valid="lookupZIPCode();"
invalid="invalidZIPCodeHandler();"/>
<!-- Bunch of TextInputs removed from this code snippet, to make it smaller -->
<mx:Label x="30" y="267" text="ZIP Code:" id="labelZIPCode"/>
<mx:TextInput x="89" y="265" id="inputZIPCode" width="101" tabIndex="11"/>
<mx:Label x="61" y="295" text="City:" id="labelCity"/>
<mx:TextInput x="89" y="293" id="inputCity" tabIndex="12"/>
<mx:Label x="257" y="279" text="State:"/>
<mx:TextInput x="257" y="293" width="50" id="inputState" tabIndex="13"/>
<mx:Label x="28" y="321" text="Phone #1:" id="labelPhone1"/>
<mx:TextInput x="89" y="319" id="inputPhone1" tabIndex="14"/>
-------------------------------------------
Thanks for any help you might be able to give,
Laurence MacNeill
Mableton, Georgia, USA
-------------------------------------------------------------
To unsubscribe from this list, simply email the list with unsubscribe in the
subject line
For more info, see http://www.affug.com
Archive @ http://www.mail-archive.com/discussion%40affug.com/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------