EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Tostring (String.tostring Method)

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
640 ActionScript classes
An example is also in the Strings.fla file in the ActionScript samples folder. The following list
gives typical paths to this folder:
Windows: boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript
Macintosh: Macintosh HD/Applications/Macromedia Flash 8/Samples and Tutorials/
Samples/ActionScript
See also
toUpperCase (String.toUpperCase method)
toString (String.toString method)
public toString() : String
Returns an object's properties as strings regardless of whether the properties are strings.
Availability: ActionScript 1.0; Flash Lite 2.0
Returns
String - The string.
Example
The following example outputs an uppercase string that lists all of an object's properties
(regardless of whether the properties are strings):
var employee:Object = new Object();
employee.name = "bob";
employee.salary = 60000;
employee.id = 284759021;
var employeeData:String = new String();
for (prop in employee)
{
employeeData += employee[prop].toString().toUpperCase() + " ";
}
trace(employeeData);
If the toString() method were not included in this code (and the line within the for loop
used
employee[prop].toUpperCase()), the output would be "undefined undefined
BOB
". By including the toString() method, the desired output is produced: "284759021
60000 BOB
".

Table of Contents

Related product manuals