I just went through that nightmare myself related to UI components.
What I ended up doing was a kludgy workaround using setInterval, storing
the selection indicies:
//capture the selection span in the currently focused textfield and save
it for when other UI elements are focused .
//A kludgy workaround since there are bugs with V2 UIComponents
(Combobox) and the Selection object.
(APPLICATION is my master object, 300 seemed to be a good interval to
capture user interaction - not many people would do something in the
text field and then click the UI component faster than 1/3rd of a
second)
myInt = setInterval(checkSelection, 300)
function checkSelection(){
if(eval(Selection.getFocus()) instanceof TextField){ //if the
focused object is a text field.
APPLICATION.prevBegin = Selection.getBeginIndex();
APPLICATION.prevEnd = Selection.getEndIndex();
}
}
Then I would access those saved vales in APPLICATION from the UI
component. Good luck, it's a bit tricky.
Jason Merrill
Bank of America
Learning & Organization Effectiveness - Technology Solutions
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:flashcoders-
>>[EMAIL PROTECTED] On Behalf Of grimmwerks
>>Sent: Sunday, September 10, 2006 1:10 PM
>>To: Flashcoders mailing list
>>Subject: [Flashcoders] Selection.getIndex() on textfield with a
button?
>>
>>Hey again
>>
>>How does one get the Selection of a textfield with a button? Seems
>>everytime I click a button, it loses the original TextField's
>>selection/focus, so both begin and end indices come back as -1.
>>
>>Any help appreciated.
>>_______________________________________________
>>[email protected]
>>To change your subscription options or search the archive:
>>http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>>Brought to you by Fig Leaf Software
>>Premier Authorized Adobe Consulting and Training
>>http://www.figleaf.com
>>http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com