|
Try these modified functions:
private function giveTextFocus(){
myText.setFocus(); doLater(this, "setTheSel"); } private function setTheSel() { Selection.setSelection(myText.text.length, myText.text.length); } ----- Original Message -----
From: Andora, Greg
Sent: Friday, March 18, 2005 8:36 PM
Subject: RE: [flexcoders] Unselecting text in a field using
AS Unfortunately, that
doesn't seem to be doing anything. I have the code I'm using to try and
test this below. In the test, I am just trying to give focus to the field
not changed and de-select the text within it.
<?xml
version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml"> <mx:Script> <![CDATA[ private function giveFocus(){ combo.setFocus(); Selection.setFocus(combo.text.length, combo.text.length); combo.open(); } private function giveTextFocus(){ myText.setFocus(); Selection.setFocus(myText.text.length, myText.text.length); } ]]> </mx:Script> <mx:Array
id="dp"> <mx:String>Brother</mx:String> <mx:String>Mom</mx:String> <mx:String>Dad</mx:String> <mx:String>Sister</mx:String> <mx:String>Uncle</mx:String> </mx:Array> <mx:Canvas> <mx:ComboBox editable="true" y="25" id="combo" change="giveTextFocus()" text="{myText.text}" width="200" dataProvider="{dp}" selectedIndex="0" /> <mx:TextInput id="myText" text="{combo.text}" change="giveFocus()" width="200"/> </mx:Canvas> </mx:Application> -----Original Message-----
Yahoo! Groups Links
|
Title: Message

