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.

clip.addEventListener(MouseEvent.MOUS<br />

E_UP, stopdragging);<br />

Sets up for keyboard event<br />

clip.addEventListener(KeyboardEvent.K<br />

EY_DOWN,reportKeyDown);<br />

clip.buttonMode = true; Sets up so movie clip can get<br />

mouse events and key events<br />

}<br />

internal function<br />

Object method<br />

startdragging(ev) {<br />

this.mclip.startDrag();<br />

dragging = true;<br />

}<br />

internal function<br />

Object method<br />

reportKeyDown(ev) {<br />

if (dragging) {<br />

if<br />

(ev.keyCode==Keyboard.RIGHT) {<br />

this.mclip.rotation +=<br />

ROTUNIT;<br />

}<br />

if<br />

(ev.keyCode==Keyboard.LEFT) {<br />

this.mclip.rotation -=<br />

ROTUNIT;<br />

} Close if<br />

} Close if dragging<br />

} Close reportKeyDown method<br />

internal function<br />

Object method<br />

stopdragging(ev) {<br />

dragging = false;<br />

this.mclip.stopDrag();<br />

}<br />

public static function<br />

Class method<br />

buildit() {<br />

var i:int;<br />

var np:Piece;<br />

for (i=0;<br />

For each of the pieces<br />

i

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

Saved successfully!

Ooh no, something went wrong!