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 />

WalkLeft<br />

TurnLeft<br />

TurnRight<br />

Notice that the labels are all added <strong>to</strong> a separate layer. Although this is not strictly necessary it is<br />

the recommended method. The same layer is used for any code we are going <strong>to</strong> add. At the end<br />

of the ‘AmbientLeft’ and ‘AmbientRight’ actions we force the playback head <strong>to</strong> move back <strong>to</strong><br />

‘AmbientLeft’ or ‘AmbientRight’ respectively using the following ‘<strong>ActionScript</strong>’ statement.<br />

or<br />

go<strong>to</strong>AndPlay("AmbientLeft");<br />

go<strong>to</strong>AndPlay("AmbientRight");<br />

To add <strong>ActionScript</strong>, click on the frame where it is going <strong>to</strong> go, making sure that you have a<br />

keyframe in this position. If no keyframe exists then press F7 <strong>to</strong> create a blank keyframe. Then<br />

select ‘Actions’ from the context menu or select ‘Window/Development Panels/Actions’. This<br />

opens the Actions panel. Type the command shown above.<br />

Figure 3.17 Moving the character using the keyboard<br />

44

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

Saved successfully!

Ooh no, something went wrong!