02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Chapter 13: Small games <strong>to</strong> keep them loading<br />

are all set <strong>to</strong> include just the number outlines. The word ‘TOTAL’ is a static text box using the<br />

same font and the label on the but<strong>to</strong>n ‘STOP’ is also static.<br />

<strong>Flash</strong> can use either embedded fonts or device font. The large text area is set <strong>to</strong> be a device font by<br />

selecting ‘_sans’ as the font. <strong>Flash</strong> includes three device fonts: ‘_sans’, ‘_serif ’ and ‘_typewriter’.<br />

On a Windows machine these will default <strong>to</strong> ‘Arial’, ‘Times’ and ‘Courier’.<br />

The large text area is set <strong>to</strong> be a dynamic text box. Because it is dynamic the only way <strong>to</strong> put<br />

multiple font formatting in<strong>to</strong> the box is <strong>to</strong> use the HTML option. This is set in the text Properties<br />

panel in the ‘Var:’ options box.<br />

Figure 13.5 Setting a dynamic text box <strong>to</strong> use HTML formatting<br />

When using HTML formatting you can set the font face, colour and size. You can include bold,<br />

underline and italic formatting. You can add a hyperlink and you can set the paragraph splits. In<br />

this example the formatting was all done in the action for frame 1 using the following <strong>ActionScript</strong>.<br />

htmltext = "Press s<strong>to</strong>p when the number is← |<br />

less than 100,000. ";<br />

htmltext += "Get more help using a HTML dynamic text box by ";<br />

htmltext += "clicking← |<br />

here";<br />

htmltext += "HTML← |<br />

formatting is flexible and very bandwidth friendly"<br />

htmltext += "This is Arial Bold size← |<br />

12";<br />

htmltext += "This is← |<br />

Times italic size 14 in red";<br />

htmltext += "This is just← |<br />

the default text"<br />

HTML text formatting adds no resources <strong>to</strong> the size of your game, but it is a very flexible way <strong>to</strong><br />

put up instructions or text that can change very dynamically. All this text is formatted within the<br />

game, or it could be loaded in<strong>to</strong> the game using ‘loadVariables’.<br />

The tags you can use are<br />

<br />

Used <strong>to</strong> create a hyperlink,<br />

This is the words you see on the page<br />

189

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

Saved successfully!

Ooh no, something went wrong!