03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - 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.

Availability: <strong>ActionScript</strong> 1.0; Flash Player 6<br />

Example<br />

This example creates a new listener object called stageListener. It then uses<br />

stageListener to call onResize <strong>and</strong> define a function that will be called when onResize is<br />

triggered. Finally, the code adds the stageListener object to the callback list of the Stage<br />

object. Listener objects allow multiple objects to listen for resize notifications.<br />

this.createTextField("stageSize_txt", this.getNextHighestDepth(), 10, 10,<br />

100, 22);<br />

var stageListener:Object = new Object();<br />

stageListener.onResize = function() {<br />

stageSize_txt.text = "w:"+Stage.width+", h:"+Stage.height;<br />

};<br />

Stage.scaleMode = "noScale";<br />

Stage.addListener(stageListener);<br />

See also<br />

align (Stage.align property), height (Stage.height property), scaleMode<br />

(Stage.scaleMode property)<br />

String<br />

Object<br />

|<br />

+-String<br />

public class String<br />

extends Object<br />

The String class is a wrapper for the string primitive data type, <strong>and</strong> provides methods <strong>and</strong><br />

properties that let you manipulate primitive string value types. You can convert the value of<br />

any object into a string using the String() function.<br />

All the methods of the String class, except for concat(), fromCharCode(), slice(), <strong>and</strong><br />

substr(), are generic, which means the methods call toString() before performing their<br />

operations, <strong>and</strong> you can use these methods with other non-String objects.<br />

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 <strong>ActionScript</strong> 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 />

1144 <strong>ActionScript</strong> classes

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

Saved successfully!

Ooh no, something went wrong!