TextSnapshot.getText()
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.getText(from:Number, to:Number [, includeLineEndings:Boolean ] ) :
String
Parameters
An integer that indicates the position of the first character of
from
the returned string. Valid values for
is a negative value, 0 is used.
An integer that is 1+ the index of the last character in
to
for
are 0 through
to
not included in the extracted string. If this parameter is omitted,
used. If this value is less than or equal to the value of
includeLineEndings
inserted into the returned string where appropriate. The default value is
Returns
A string containing the characters in the specified range, or an empty string if no characters are
found in the specified range.
Description
Method; returns a string that contains all the characters specified by the
If no characters are selected, an empty string is returned.
To return all characters, pass a value of 0 for
large number) for
If you pass a value of
returned where deemed appropriate. In this case, the return string might be longer than the input
range. If
includeLineEndings
characters added.
Example
The following example illustrates how you can output the number of characters in a specified
TextSnapshot object. To use this code, create a static text field that contains the text
"TextSnapshot Example".
// This example assumes that the movie clip contains
// the static text "TextSnapshot Example"
var my_mc:MovieClip = this;
var my_snap:TextSnapshot = my_mc.getTextSnapshot();
var count:Number = my_snap.getCount();
var theText:String = my_snap.getText(0, count, false);
794
Chapter 7: ActionScript for Flash
from
TextSnapshot.getCount()
An optional Boolean value that specifies whether newline characters are
. To return a single character, pass a value of
to
for
true
includeLineEndings
is
false
are 0 through
TextSnapshot.getCount()
my_snap
. The character indexed by the
,
from
from+1
and
from
TextSnapshot.getCount()
, newline characters are inserted in the string
or omitted, the selected text is returned without any
to be included in
my_snap
- 1. If
to be examined. Valid values
parameter is
to
TextSnapshot.getCount()
is used.
.
false
and
parameters.
from
to
(or any very
for
.
from+1
to
from
is
Need help?
Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?
Questions and answers