header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
vasi
Points:200
Posts:1

3/15/2010 3:31:30 AM

Title: Flash Text Input


Hi all,
i want to highlight text in text input component on mouse click. is there any way?



Mack
Points: 0
Posts:0
3/15/2010 9:56:25 AM



Check the following code it selects the text specified by giving the starting index and ending index. Remember that first you need to set focus , otherwise the selection is not visible.




<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768">
	<mx:Script>
		<![CDATA[
			protected function button1_clickHandler(event:MouseEvent):void
			{
				//set the focus to text box
				txtBox.setFocus()
				//select the text starting from 8 to 15 index
				txtBox.setSelection(8,15);
			}
		]]>
	</mx:Script>
	<mx:TextInput id="txtBox" text=" asad aadaa dadad ada das dadad asd a">
	</mx:TextInput>
	<mx:Button label=" Click to select Text" mouseUp="button1_clickHandler(event)" x="400">
	</mx:Button>
</mx:Application>




Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 0+4 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions