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

Create successful ePaper yourself

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

}<br />

}<br />

}<br />

}<br />

Créez un document CSS appelé styles.css, qui a <strong>de</strong>ux styles appelés .heading et .mainBody<br />

définissant les propriétés pour font-family, font-size et font-weight. Entrez le co<strong>de</strong><br />

suivant dans le document CSS :<br />

/~ In styles.css ~/<br />

.heading {<br />

font-family: Arial, Helvetica, sans-serif;<br />

font-size: 24px;<br />

font-weight: bold;<br />

}<br />

.mainBody {<br />

font-family: Arial, Helvetica, sans-serif;<br />

font-size: 12px;<br />

font-weight: normal;<br />

}<br />

Enfin, dans un fichier FLA ou <strong>ActionScript</strong>, tapez le co<strong>de</strong> <strong>ActionScript</strong> suivant pour charger<br />

la feuille <strong>de</strong> style externe, styles.css :<br />

StyleSheetTracer.displayFromURL("styles.css");<br />

Cet exemple donne les résultats suivants dans le panneau <strong>de</strong> sortie :<br />

Style .heading:<br />

fontWeight: bold<br />

fontSize: 24px<br />

fontFamily: Arial, Helvetica, sans-serif<br />

Style .mainBody:<br />

fontWeight: normal<br />

fontSize: 12px<br />

fontFamily: Arial, Helvetica, sans-serif<br />

Voir également<br />

getStyleNames (métho<strong>de</strong><br />

StyleSheet.getStyleNames)<br />

public getStyleNames() : Array<br />

Renvoie un tableau qui contient les noms (sous formes <strong>de</strong> chaînes) <strong>de</strong> tous les styles<br />

enregistrés dans cette feuille <strong>de</strong> style.<br />

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

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

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

Saved successfully!

Ooh no, something went wrong!