Call the toString() method. This method returns the string representation of any type of object if available.
package{
import flash.display.Sprite;
public class Main extends Sprite{
public function Main(){
var sTitle:String = new String("ActionScript Bible");
trace(sTitle.toString()); // Displays: ActionScript Bible
//By default, the toString() method of an object is called if you attempt to use it where Flash is expecting a string.
var sTitle:String = new String("ActionScript Bible");
trace(sTitle); // Displays: ActionScript Bible
}
}
}
Related examples in the same category