Can anyone tell me why this outputs -1 for every value? Could it be because the
textfield looses focus when I click on the button component? I am trying to
get the first and last position of the selected text in a dynamic textfield.
Any pointers would be awesome!
Outputs: String to Underline: |B: -1 |E: -1 |C: -1
var underline_check:Object = new Object();
underline_check.click = function(eventObj:Object) {
var startIndex:Number = Selection.getBeginIndex();
var endIndex:Number = Selection.getEndIndex();
var strToUnderline:String = editdesc_txt.text.substring(startIndex,
endIndex);
trace("String to Underline: "+strToUnderline + "|B:
"+Selection.getBeginIndex()+ " |E: "+Selection.getEndIndex() + " |C:
"+Selection.getCaretIndex());
editdesc_txt.replaceText(startIndex, endIndex, "<u>"+strToUnderline+"</u>");
};
underline_btn.addEventListener("click", underline_check);
Boots
_______________________________________________
[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