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.

Figure 8.5 Properties window for the movie clip ‘Light’<br />

Chapter 8: In tip-<strong>to</strong>p condition<br />

Notice that the box below the drop-down displaying the title ‘Movie Clip’ contains the word<br />

‘Light’. If you plan <strong>to</strong> access a movie clip in <strong>ActionScript</strong> then you must name it in this box. Below<br />

the Light is a dynamic text box displaying the text ‘No overlap’. A dynamic text field is a text field<br />

that you can get and set with <strong>ActionScript</strong>. Figure 8.6 shows the Properties window for this.<br />

Figure 8.6 Properties window for dynamic text field<br />

The easiest way <strong>to</strong> manipulate the text is just <strong>to</strong> link it <strong>to</strong> a variable by setting the ‘Var’ property.<br />

Notice in the figure that this is highlighted and contains the word ‘overlap’. If we set the variable<br />

overlap in code then we will see this displayed in this text field. If you want it look like you<br />

see it, then you must embed the fonts. Click the ‘Character…’ but<strong>to</strong>n and you’ll see the dialog<br />

box displayed in Figure 8.7.<br />

Because in this project we know that the dynamic text field will contain either ‘No overlap’ or<br />

‘Inside’, just the letters that make up this type are embedded using the ‘Include these characters:’<br />

edit box.<br />

The final symbol that is on the stage is the box with the rounded corners. This has an instance<br />

name of ‘Box’. It is this movie clip that contains all the functionality for the project. Listing 8.1<br />

shows the code.<br />

1 onClipEvent(enterFrame){<br />

2 if (_xmouse>0 && _xmouse0 && _ymouse

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

Saved successfully!

Ooh no, something went wrong!