412
Chapter 6: ActionScript Core Classes
Description
Method; returns a string comprising the characters represented by the ASCII values in
the parameters.
Example
The following example uses
fromCharCode()
to insert an
@
character in the e-mail address:
var address_str:String = "dog"+String.fromCharCode(64)+"house.net";
trace(address_str); // output: [email protected]
String.indexOf()
Availability
Flash Player 5.
Usage
my_str
.indexOf(
substring:String,
[
startIndex:Number
])
Parameters
substring
A string; the substring to be searched for within
my_str
.
startIndex
A number; an optional integer specifying the starting point in
my_str
to search for
the substring.
Returns
A number; the position of the first occurrence of the specified substring or -1.
Description
Method; searches the string and returns the position of the first occurrence of
substring
found at or after
startIndex
within the calling string. This index is zero-based, meaning that the
first character in a string is considered to be at index 0—not index 1. If
substring
is not found,
the method returns -1.
Example
The following examples use
indexOf()
to return the index of characters and substrings:
var searchString:String = "Lorem ipsum dolor sit amet.";
var index:Number;
index = searchString.indexOf("L");
trace(index); // output: 0
index = searchString.indexOf("l");
trace(index); // output: 14
index = searchString.indexOf("i");
trace(index); // output: 6
index = searchString.indexOf("ipsum");
trace(index); // output: 6
Содержание FLEX-FLEX ACTIONSCRIPT LANGUAGE
Страница 1: ...Flex ActionScript Language Reference...
Страница 8: ......
Страница 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Страница 76: ......
Страница 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Страница 135: ...case 135 See also break default strict equality switch...
Страница 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Страница 229: ...while 229 i 3 The following result is written to the log file 0 3 6 9 12 15 18 See also do while continue for for in...
Страница 808: ...808 Chapter 7 ActionScript for Flash...
Страница 810: ...810 Appendix A Deprecated Flash 4 operators...
Страница 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Страница 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Страница 822: ...822 Index...