03.05.2013 Views

Tutorial: Jigsaw using ActionScript 3.0.

Tutorial: Jigsaw using ActionScript 3.0.

Tutorial: Jigsaw using ActionScript 3.0.

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The constructor function Piece includes a statement that adds the newly constructed<br />

Piece object to this array. The buildit, mixup and checkit functions make use<br />

of pieces.<br />

Class definitions are contained in packages. Specifically, each class definition is in its<br />

own file and the contents of the file are<br />

package jigsaw {<br />

class Piece {<br />

…<br />

}<br />

}<br />

The example here has just one class and, therefore, just one file: Piece.as. It MUST<br />

go in a folder named jigsaw and I placed it in a folder I named as3 directly in my C<br />

drive. See below concerning the specification of the classpath that indicates to the<br />

Flash environment where the packages are located.<br />

The code interprets the key stroke event <strong>using</strong> built-in variables.<br />

Implementation<br />

You need to prepare two files for this application: the .fla file and the .as file that<br />

holds the package that holds the Piece definition. The name of the .as file must be<br />

Piece.as. It needs to go in a folder with the same name as the package, namely<br />

jigsaw, and the jigsaw folder must be in a folder named in the classpath list. I<br />

will give instructions on this later.<br />

Start by opening up the Flash environment, under Create New, click on Flash File<br />

(<strong>ActionScript</strong> 3.0)

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

Saved successfully!

Ooh no, something went wrong!