MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference page 977

Actionscript language reference
Table of Contents

Advertisement

Note: If characters don't appear to be selected when you run the code, you must also place a
dynamic text field on the Stage. See "Description" in this entry.
// This example assumes that the movie clip contains
// the static text "TextSnapshot Example"
var my_snap:TextSnapshot = this.getTextSnapshot();
var count:Number = my_snap.getCount();
my_snap.setSelectColor(0xFF0000); // Set the selection color to red.
my_snap.setSelected(0, 4, true); // Select the first four characters.
my_snap.setSelected(1, 2, false); // Deselect the second character (leaving
the rest selected).
var firstCharIsSelected:Boolean = my_snap.getSelected(0, 1);
var secondCharIsSelected:Boolean = my_snap.getSelected(1, 2);
var theText:String = my_snap.getSelectedText(false); // get the selected text
trace(theText); // output: Txt
trace(firstCharIsSelected); // output: true
trace(secondCharIsSelected); // output: false
TextSnapshot.setSelected()
977

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004-ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents