PDA

View Full Version : Problem with rotating jigsaw piece


mudskipper
03-20-2005, 10:31 AM
Hi all,

I have made a 9-piece jigsaw puzzle. When a click on a puzzle piece (movie clip) and try to rotate it using the space bar another piece will rotate instead. Here is the AS for 'piece4'.

on(press){
startDrag(this);
this.swapDepths(100);
}
on(keyPress "<Space>"){
this._rotation +=90;
}
on (release){
stopDrag();
if
(this._droptarget=="/target4")
{
setProperty(this,_x,332.1);
setProperty(this,_y,200.9);
}else{
setProperty(this,_x,68.0);
setProperty(this,_y,107.5);
}
}

I understand that I need to specify that 'piece4' is the one that must rotate but don't know where (presume line 6) and what code, to insert to make each piece rotate when selected. I have tried numerous combinations but am not making any progress.

Thanks

drumn4life0789
02-20-2007, 04:46 AM
I know this is old but this could help others, maybe.

add get new depth where shown

on (press){
startdrag.this
getnewdepth(1)}


then later you can put an if statement.

if (piece4 depth=1) = function
on key press, space rotate 90

i know thats not the right code but it should help out i think.