03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

fromCharCode (String.fromCharCode method)<br />

public static fromCharCode() : String<br />

Returns a string comprising the characters represented by the Unicode values in the<br />

parameters.<br />

Returns<br />

String - A string value of the specified Unicode character codes.<br />

Example<br />

The following example uses fromCharCode() to insert an @ character in the e-mail address:<br />

var address_str:String = "dog"+String.fromCharCode(64)+"house.net";<br />

trace(address_str); // output: dog@house.net<br />

indexOf (String.indexOf method)<br />

public indexOf(value:String, [startIndex:Number]) : Number<br />

Searches the string <strong>and</strong> returns the position of the first occurrence of value found at or after<br />

startIndex within the calling string. This index is zero-based, meaning that the first<br />

character in a string is considered to be at index 0--not index 1. If value is not found, the<br />

method returns -1.<br />

Parameters<br />

value:String - A string; the substring to search for.<br />

startIndex:Number [optional] - An integer specifying the starting index of the search.<br />

Returns<br />

Number - The position of the first occurrence of the specified substring or -1.<br />

Example<br />

The following examples use indexOf() to return the index of characters <strong>and</strong> substrings:<br />

var searchString:String = "Lorem ipsum dolor sit amet.";<br />

var index:Number;<br />

index = searchString.indexOf("L");<br />

trace(index); // output: 0<br />

index = searchString.indexOf("l");<br />

trace(index); // output: 14<br />

index = searchString.indexOf("i");<br />

596 ActionScript classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!