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.

<strong>Flash</strong> <strong>MX</strong> <strong>2004</strong> <strong>Games</strong><br />

As the stars pass the maximum height they explode, with the number of stars in the explosion<br />

defined using the ‘subStarTotal’ parameter.<br />

Figure 9.5 Defining Component Parameters<br />

To define the parameters that appear in the Components Parameters panel, right-click on the<br />

movie clip in the Library panel and select ‘Component Definition’. You will see a dialog box like<br />

the one in Figure 9.5. Here you can set the name of the variable, what its default value will be, the<br />

value it takes just by a drag and drop without the user setting any specific values, and the type of<br />

variable. The new architecture of v2 components allows you <strong>to</strong> hide the complexity completely<br />

using separate class files and compiled components, so that the contents cannot be altered. In this<br />

example we use a simpler technique that is still very effective. By changing the variable values,<br />

the code inside the movie clip that uses these values is affected. The ‘starTotal’ and ‘subStarTotal’<br />

parameters are used by repeat loops inside the clip. Here is an example:<br />

130<br />

for (i=0; i

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

Saved successfully!

Ooh no, something went wrong!