796
Chapter 7: ActionScript for Flash
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, h1, true);
}
};
See also
MovieClip.getTextSnapshot()
,
MovieClip._x
,
MovieClip._y
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
hexColor
The color used for the border placed around characters that have been selected by the
corresponding
TextSnapshot.setSelected()
command, expressed in
0xRRGGBB
format.
Returns
Nothing.
Description
Method; specifies the color to use when highlighting characters that have been selected with the
TextSnapshot.setSelected()
command. The color is always opaque; you can’t specify a
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.
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...