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.

Exemple<br />

Pour consulter un exemple <strong>de</strong> chargement asynchrone <strong>de</strong>s feuilles <strong>de</strong> style avec <strong>ActionScript</strong><br />

<strong>2.0</strong>, consultez l'exemple pour getStyle().<br />

L'exemple suivant charge le fichier CSS appelé styles.css dans l'objet StyleSheet<br />

my_styleSheet. Lorsque le fichier a été chargé avec succès, l'objet StyleSheet est appliqué à<br />

un objet TextField appelé news_txt.<br />

import TextField.StyleSheet;<br />

this.createTextField("news_txt", 999, 10, 10, 320, 240);<br />

news_txt.multiline = true;<br />

news_txt.wordWrap = true;<br />

news_txt.html = true;<br />

var my_styleSheet:StyleSheet = new StyleSheet();<br />

my_styleSheet.onLoad = function(success:Boolean) {<br />

if (success) {<br />

news_txt.styleSheet = my_styleSheet;<br />

news_txt.htmlText = "Heading goes here!"<br />

+ "Lorem ipsum dolor sit amet, consectetuer "<br />

+ "adipiscing elit, sed diam nonummy nibh euismod tinci<strong>du</strong>nt ut laoreet<br />

"<br />

+ "dolore magna aliquam erat volutpat.";<br />

}<br />

};<br />

my_styleSheet.load("styles.css");<br />

Vous trouverez l'intégralité <strong>du</strong> co<strong>de</strong> <strong>de</strong> styles.css dans l'exemple pour getStyle().<br />

Voir également<br />

onLoad (gestionnaire StyleSheet.onLoad), getStyle (métho<strong>de</strong><br />

StyleSheet.getStyle)<br />

onLoad (gestionnaire StyleSheet.onLoad)<br />

onLoad = function(success:Boolean) {}<br />

Appelé lorsqu'une opération load() est terminée. Si la StyleSheet a été chargée avec succès, le<br />

paramètre success est true. Si le document n'a pas été reçu, ou si une erreur est survenue au<br />

cours <strong>de</strong> la réception <strong>de</strong> la réponse provenant <strong>du</strong> serveur, le paramètre success est false.<br />

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

Paramètres<br />

success:Boolean - Valeur booléenne indiquant si le fichier CSS a été chargé avec succès<br />

(true) ou pas (false).<br />

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

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

Saved successfully!

Ooh no, something went wrong!