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.

Because all string indexes are zero-based, the index of the last character for any string x is<br />

x.length - 1.<br />

You can call any of the methods of the String class using the constructor method new String<br />

or using a string literal value. If you specify a string literal, the ActionScript interpreter<br />

automatically converts it to a temporary String object, calls the method, <strong>and</strong> then discards the<br />

temporary String object. You can also use the String.length property with a string literal.<br />

Do not confuse a string literal with a String object. In the following example, the first line of<br />

code creates the string literal first_string, <strong>and</strong> the second line of code creates the String<br />

object second_string:<br />

var first_string:String = "foo"<br />

var second_string:String = new String("foo")<br />

Use string literals unless you specifically need to use a String object.<br />

Property summary<br />

Modifiers Property Description<br />

Properties inherited from class Object<br />

Constructor summary<br />

Method summary<br />

592 ActionScript classes<br />

length:Number An integer specifying the number of characters in<br />

the specified String object.<br />

constructor (Object.constructor property), __proto__ (Object.__proto__<br />

property), prototype (Object.prototype property), __resolve<br />

(Object.__resolve property)<br />

Signature Description<br />

String(value:String Creates a new String object.<br />

)<br />

Modifiers Signature Description<br />

charAt(index:Number)<br />

: String<br />

charCodeAt(index:Num<br />

ber) : Number<br />

concat(value:Object)<br />

: String<br />

Returns the character in the position specified by<br />

the parameter index.<br />

Returns a 16-bit integer from 0 to 65535 that<br />

represents the character specified by index.<br />

Combines the value of the String object with the<br />

parameters <strong>and</strong> returns the newly formed string;<br />

the original value, my_str, is unchanged.

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

Saved successfully!

Ooh no, something went wrong!