03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

toString (String.toString method)<br />

public toString() : String<br />

Returns an object's properties as strings regardless of whether the properties are strings.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Returns<br />

String - The string.<br />

Example<br />

The following example outputs an uppercase string that lists all of an object's properties,<br />

regardless of whether the properties are strings:<br />

var employee:Object = new Object();<br />

employee.name = "bob";<br />

employee.salary = 60000;<br />

employee.id = 284759021;<br />

var employeeData:String = new String();<br />

for (prop in employee)<br />

{<br />

employeeData += employee[prop].toString().toUpperCase() + " ";<br />

}<br />

trace(employeeData);<br />

If the toString() method were not included in this code, <strong>and</strong> the line in the for loop used<br />

employee[prop].toUpperCase(), the output would be "undefined undefined BOB".<br />

Including the toString() method produces the desired output: "284759021 60000 BOB".<br />

toUpperCase (String.toUpperCase method)<br />

public toUpperCase() : String<br />

Returns a copy of this string, with all lowercase characters converted to uppercase. The<br />

original string is unmodified.<br />

This method converts all characters (not simply a-z) for which Unicode uppercase equivalents<br />

existThese case mappings are defined in the UnicodeData.txt file <strong>and</strong> the SpecialCasings.txt<br />

file, as defined in the Unicode Character Database specification.<br />

Availability: <strong>ActionScript</strong> 1.0; Flash Player 5<br />

Returns<br />

String - A string.<br />

1158 <strong>ActionScript</strong> classes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!