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

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
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

Table of Contents