jeudi 8 octobre 2015

AS3 gotoAndStop and if-else-if

i am trying to make a rotational view of a block in 6 frames with 1-4 being the facing 4 sides, and 5-6 being top and bottom. i have 4 arrows to "rotate" this view. i am able to rotate 1-6 but unable to rotate from 5 & 6 back to 1-4. this is my code. i am bad with AS, so pls be merciful with my mistakes..

btn_view_right.addEventListener(MouseEvent.CLICK, viewRight);
function viewRight(event: MouseEvent): void {

if (currentFrame == 1) {
    gotoAndStop(2);
} else if (currentFrame == 4) {
    gotoAndStop(1);
} else if (currentFrame == 5) {
    gotoAndStop(6);
} else if (currentFrame == 6) {
    gotoAndStop(5);
} else {
    nextFrame();
}
}
btn_view_top.addEventListener(MouseEvent.CLICK, viewTop);
function viewTop(event: MouseEvent): void {
if (currentFrame == 1, 2, 3, 4) {
    gotoAndStop(5);
} else if (currentFrame == 5, 6) {
    gotoAndStop(1);
}
}

Aucun commentaire:

Enregistrer un commentaire