Flash Lite 2.x and 3.0 ActionScript Language Reference

valueOf (String.valueOf method)

public valueOf() : String

Returns the string.

Returns

String - The value of the string.

Example

The following example creates a new instance of the String object and then shows that the valueOf method returns a reference to the primitive value, rather than an instance of the object.

var str:String = new String("Hello World");
var value:String = str.valueOf();
trace(str instanceof String); // true
trace(value instanceof String); // false
trace(str === value); // false