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.

■ Sélectionnez Nouvelle Police dans le menu contextuel.<br />

■ Nommez la police myArial.<br />

■ Sélectionnez Arial dans le menu contextuel <strong>de</strong> police.<br />

■ Cliquez sur OK.<br />

■ Cliquez <strong>du</strong> bouton droit sur la nouvelle police créée et sélectionnez Liaison.<br />

■ Activez la case à cocher Exporter pour <strong>ActionScript</strong>.<br />

■ Cliquez sur OK pour accepter l'i<strong>de</strong>ntifiant par défaut, myArial.<br />

import flash.text.TextRen<strong>de</strong>rer;<br />

var antiAliasEntry_1 = {fontSize:24, insi<strong>de</strong>Cutoff:1.61, outsi<strong>de</strong>Cutoff:-<br />

3.43};<br />

var antiAliasEntry_2 = {fontSize:48, insi<strong>de</strong>Cutoff:0.8, outsi<strong>de</strong>Cutoff:-0.8};<br />

var arialTable:Array = new Array(antiAliasEntry_1, antiAliasEntry_2);<br />

var lbl_1:TextField = createLabel(0, 0, 300, 100, 24);<br />

var lbl_2:TextField = createLabel(0, 100, 300, 100, 48);<br />

TextRen<strong>de</strong>rer.setAdvancedAntialiasingTable("Arial", "none", "dark",<br />

arialTable);<br />

function createLabel(x:Number, y:Number, width:Number, height:Number,<br />

fontSize:Number):TextField {<br />

var <strong>de</strong>pth:Number = this.getNextHighestDepth();<br />

}<br />

var tmpTxt = this.createTextField("txt_" + <strong>de</strong>pth, <strong>de</strong>pth, x, y, width,<br />

height);<br />

tmpTxt.antiAliasType = "advanced";<br />

tmpTxt.gridFitType = "pixel";<br />

tmpTxt.bor<strong>de</strong>r = true;<br />

tmpTxt.text = "Hello World";<br />

tmpTxt.embedFonts = true;<br />

tmpTxt.setTextFormat(getTextFormat(fontSize));<br />

return tmpTxt;<br />

function getTextFormat(fontSize:Number):TextFormat {<br />

var tf:TextFormat = new TextFormat();<br />

tf.align = "center";<br />

tf.size = fontSize;<br />

tf.font = "myArial";<br />

return tf;<br />

}<br />

TextRen<strong>de</strong>rer (flash.text.TextRen<strong>de</strong>rer) 1295

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

Saved successfully!

Ooh no, something went wrong!