MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 796

Actionscript language reference
Table of Contents

Advertisement

Example
The following example illustrates how to use this method. To use this code, place a static text field
containing the text "TextSnapshot Example" on the Stage. To test the code, move the pointer over
the static text field.
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_mc:MovieClip = this;
var my_ts:TextSnapshot = my_mc.getTextSnapshot();
my_mc.onMouseMove = function() {
// find which character the mouse pointer is over (if any)
var hitIndex:Number = my_ts.hitTestTextNearPos(_xmouse, _ymouse, 0);
// deselect everything
my_ts.setSelected(0, my_ts.getCount(), false);
if (hitIndex>=0) {
// select the single character the mouse pointer is over
my_ts.setSelected(hitIndex, hitIndex+1, true);
}
};
See also
MovieClip.getTextSnapshot(), MovieClip._x,
TextSnapshot.setSelectColor()
Availability
Authoring: Flash MX 2004.
Playback: SWF files published for Flash Player 6 or later, playing in Flash Player 7 or later.
Usage
my_snap.setSelectColor(hexColor:Number);
Parameters
The color used for the border placed around characters that have been selected by the
hexColor
corresponding
TextSnapshot.setSelected()
Returns
Nothing.
Description
Method; specifies the color to use when highlighting characters that have been selected with the
TextSnapshot.setSelected()
transparency value.
This method functions correctly only for fonts that include character metric information; by
default, Flash does not include this information for static text fields. In some cases, this behavior
means that the method returns -1 instead of an index value.
796
Chapter 7: ActionScript for Flash
MovieClip._y
command, expressed in
command. The color is always opaque; you can't specify a
format.
0xRRGGBB

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Flex

Table of Contents