Tostring (String.tostring Method) - MACROMEDIA FLASHLITE2 ACTIONSCRIPT-LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

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
- The string.
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
method were not included in this code (and the line within the
toString()
used
employee[prop].toUpperCase()
". By including the
BOB
".
60000 BOB
640
ActionScript classes
), the output would be "
method, the desired output is produced: "
toString()
for
undefined undefined
284759021
loop

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASHLITE2 ACTIONSCRIPT-LANGUAGE and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash lite 2

Table of Contents