Yes, your application has to get focus.

Look at the following...

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute"
     creationComplete="onCreationComplete()"
click="onCreationComplete()">
     <mx:Script>
         <![CDATA[
             private function onCreationComplete():void
             {
                 textArea.selectionBeginIndex=10;
                 textArea.selectionEndIndex=19;
                 textArea.setFocus();
             }
         ]]>
     </mx:Script>
     <mx:TextArea id="textArea" width="300"
         text="The quick brown fox jumped over the lazy dog"/>
</mx:Application>


--- In flexcoders@yahoogroups.com, "Keith Reinfeld" <[EMAIL PROTECTED]>
wrote:
>
> Your application has to get focus before this will work.
>
> Regards,
>
> -Keith
> http://keithreinfeld.home.comcast.net
> <http://keithreinfeld.home.comcast.net/>
>
>
>   _____
>
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On
> Behalf Of tchredeemed
> Sent: Wednesday, October 29, 2008 9:30 AM
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] textArea.setFocus();
>
>
>
> When I launch my application, if I do this:
>
> textArea.selectionBeginIndex=10;
> textArea.selectionEndIndex=20;
> textArea.setFocus();
>
> Should it not put the cursor into the textArea and have the 10th
> through 20th characters selected?
>
> So that by default, if I put that in creationComplete, and they just
> start typing when the app loads, it starts to replace the 10th through
> 20th characters with what they type?
>
> As of right now, I do not see a cursor when I run.
>
> Any ideas?!
>

Reply via email to