03.07.2013 Views

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

Guide de reference du langage ActionScript 2.0 - PowWeb

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.

Paramètres<br />

xmlLanguageCo<strong>de</strong>:String - Le co<strong>de</strong> <strong>de</strong> langue <strong>du</strong> fichier <strong>de</strong> langue XML que vous souhaitez<br />

charger.<br />

customXmlCompleteCallback:Function - La fonction <strong>de</strong> rappel personalisée à appeler<br />

lorsque le fichier <strong>de</strong> langue XML est chargé.<br />

Exemple<br />

L'exemple suivant utilise la métho<strong>de</strong> loadLanguageXML() pour charger le fichier <strong>de</strong> langue<br />

XML Anglais (en). Une fois le fichier <strong>de</strong> langue chargé, la métho<strong>de</strong> localeCallback() est<br />

appelée et renseigne le champ <strong>de</strong> texte greeting_txt présent sur la scène avec le contenu <strong>de</strong><br />

la chaîne IDS_GREETING <strong>du</strong> fichier XML.<br />

import mx.lang.Locale;<br />

Locale.setLoadCallback(localeCallback);<br />

Locale.loadLanguageXML("en");<br />

// create interval to check if language XML file is loa<strong>de</strong>d<br />

var locale_int:Number = setInterval(checkLocaleStatus, 10);<br />

function checkLocaleStatus():Void {<br />

if (Locale.checkXMLStatus()) {<br />

clearInterval(locale_int);<br />

trace("clearing interval @ " + getTimer() + " ms");<br />

}<br />

}<br />

// callback function for Locale.setLoadCallback()<br />

function localeCallback(success:Boolean):Void {<br />

greeting_txt.text = Locale.loadString("IDS_GREETING");<br />

}<br />

loadString (métho<strong>de</strong> Locale.loadString)<br />

statique publique loadString(id:String) : String<br />

Renvoie la valeur <strong>de</strong> chaîne associée à l'ID <strong>de</strong> chaîne spécifié dans la langue actuellement<br />

utilisée.<br />

Disponibilité : <strong>ActionScript</strong> <strong>2.0</strong> ; Flash Player 7<br />

Paramètres<br />

id:String - Le numéro d'i<strong>de</strong>ntification (ID) <strong>de</strong> la chaîne à charger.<br />

Renvoie<br />

String - La valeur <strong>de</strong> chaîne associée à l'ID <strong>de</strong> chaîne spécifié dans la langue actuellement<br />

utilisée.<br />

762 Chapitre 2: Classes <strong>ActionScript</strong>

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

Saved successfully!

Ooh no, something went wrong!