[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Selecting text in textbox via ActionScript in Flash

Posted on 2007-07-24
4
Medium Priority
?
2,042 Views
Last Modified: 2012-06-21
How do you select a portion of text in a textbox via actionscript?  Is this a property that can be set and/or read form actionscript?

Visual example of what I mean by selecting text in textbox:
http://www.databasedev.co.uk/image/cursor_default_selection.gif

Thanks in advance!
0
Comment
Question by:mediapanderer
  • 2
  • 2
4 Comments
 
LVL 6

Accepted Solution

by:
ArulPrasad1 earned 2000 total points
ID: 19555473
You can use the Selection object to achieve this:

Selection.setFocus(txtFieldInstanceName);
Selection.setSelection ( beingIndex, endIndex);

The first line sets Focus on the appropriate textfield. As you see in my code snippet, you'll have to pass the instance name of your textfield.

The second line, sets selection. the first parameter is the starting point, and the second is the end point.

You can have only one object in focus, in Flash. So if you click on another object, the selection you set as above will be lost.
0
 

Author Comment

by:mediapanderer
ID: 19614684
Perfect, thanks!

Do you happen to know another way to highlight text in a textbox, not using the selection (to allow for clicking on other objects)?
0
 
LVL 6

Assisted Solution

by:ArulPrasad1
ArulPrasad1 earned 2000 total points
ID: 19615115
If you are using AS3 and flash player 9, you can do this using the

alwaysShowSelection

property of textfields. Flash player 8 and below don't have this ability.
0
 

Author Comment

by:mediapanderer
ID: 19899582
Perfect, thanks!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question