Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

10. Text > Selecting Text

Selecting Text

Your control over text and text fields is not limited to styling or input. You can also track user selections or even select portions of a field programmatically and replace its content.

The following example, found in the text_field_4.fla source file, uses the button creation class discussed in Chapter 8 to create two buttons that allow you to select and replace a word of text. The first block of code consists only of material discussed previously in this and prior chapters. Line 1 imports the RoundRectButton class, lines 3 through 11 create and setup a dynamic text field, and lines 12 through 28 create two buttons and add event listeners to trigger the functions at the end of the script.

Note

You can select text content with code when using either dynamic or input text fields.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint