Code not working


hi guys i've come code , isnt doing want do, want have hit 3 buttons in particular order move page heres code i've come with, can 1 of please tell me im going wrong?

 

stop()

 

var hit3:number=0;

 

function drumbeat3 (event:mouseevent) :void {

 

    if(event.target == kick3)

    {

        if(hit == 0)

            hit++;

        else

            hit = 0;

    }

 

    if(event.target == snare3)

    {

        if(hit == 1)

            hit++;

        else

            hit = 0;

    }

 

    if(event.target == cymbol3)

    {

        if(hit == 2)

            hit++;

        else

            hit = 0;

    }

 

    hit++;

}

 

function checkpage6(e:event):void {

    if (hit3 == 3) {

        gotoandplay("bedroom1");

    }

}

 

kick3.addeventlistener(mouseevent.click, drumbeat3);

snare3.addeventlistener(mouseevent.click, drumbeat3);

cymbol3.addeventlistener(mouseevent.click, drumbeat3);

i don`t understand why need 2 different variables track hits? writing error?

var hit:int=0;

 

...

    if (hit == 3) {

        gotoandplay("bedroom1");

    }

 

...

the have line practically override conditions put before it:

 

if(event.target == cymbol3)

    {

        if(hit == 2)

            hit++;

        else

            hit = 0;

    }

 

   hit++;

 

you should rid of that



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to set the order of FAQs instead of alphabetical

Thread: Get UK Keyboard working

how do I change the e-mail address for my merchant account