13.08.2012 Views

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

ACTIONSCRIPT 3 Developer’s Guide en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>ACTIONSCRIPT</strong> 3.0 DEVELOPER’S GUIDE<br />

Localizing applications<br />

You can write code to format dates, times, and curr<strong>en</strong>cies. For example, the following code converts a Date object into<br />

month/day/year format or day/month/year format. if the locale variable (repres<strong>en</strong>ting the locale) is set to "<strong>en</strong>_US",<br />

the function returns month/day/year format. The example converts a Date object into day/month/year format for all<br />

other locales:<br />

function convertDate(date)<br />

{<br />

if (locale == "<strong>en</strong>_US")<br />

{<br />

return (date.getMonth() + 1) + "/" + date.getDate() + "/" + date.getFullYear();<br />

}<br />

else<br />

{<br />

return date.getDate() + "/" + (date.getMonth() + 1) + "/" + date.getFullYear();<br />

}<br />

}<br />

ADOBE FLEX<br />

The Flex framework includes controls for formatting dates, times, and curr<strong>en</strong>cies. These controls include the<br />

DateFormatter and Curr<strong>en</strong>cyFormatter controls.<br />

mx:DateFormatter<br />

mx:Curr<strong>en</strong>cyFormatter<br />

Last updated 6/6/2012<br />

958

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

Saved successfully!

Ooh no, something went wrong!