Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Hi guys im completely new to this so go easy

New Here ,
May 06, 2013 May 06, 2013

Basically i'm trying to get this function to add one to a variable and then when the variable hits a certian number I want it to go to a different page. Heres the code ive come up with

var Hit:Number=0;

Cymbol2.addEventListener(MouseEvent.CLICK, DrumBeat);

Kick2.addEventListener(MouseEvent.CLICK, DrumBeat);

function Drumbeat (event:MouseEvent) :void {Hit=+1}

function checkPage(e:Event):void {

    if (Hit==3) {

        gotoAndPlay("Bedroom1");

    }

}

Any help would be greatly appreciated

TOPICS
ActionScript
564
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 06, 2013 May 06, 2013

use:

var Hit:Number=0;

Cymbol2.addEventListener(MouseEvent.CLICK, DrumBeat);

Kick2.addEventListener(MouseEvent.CLICK, DrumBeat);

function Drumbeat (e:MouseEvent) :void {

Hit+=1;

checkPage(e);

}

function checkPage(e:Event):void {

    if (Hit==3) {

        gotoAndPlay("Bedroom1");

    }

}

Translate
Community Expert ,
May 06, 2013 May 06, 2013

use:

var Hit:Number=0;

Cymbol2.addEventListener(MouseEvent.CLICK, DrumBeat);

Kick2.addEventListener(MouseEvent.CLICK, DrumBeat);

function Drumbeat (event:MouseEvent) :void {

Hit+=1;

checkPage(e);

}

function checkPage(e:Event):void {

    if (Hit==3) {

        gotoAndPlay("Bedroom1");

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2013 May 06, 2013

Thank you so much for the reply, tried this code out and I get an error code which says "access of undefined property e" what would I need to change to correct this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2013 May 06, 2013

use:

var Hit:Number=0;

Cymbol2.addEventListener(MouseEvent.CLICK, DrumBeat);

Kick2.addEventListener(MouseEvent.CLICK, DrumBeat);

function Drumbeat (e:MouseEvent) :void {

Hit+=1;

checkPage(e);

}

function checkPage(e:Event):void {

    if (Hit==3) {

        gotoAndPlay("Bedroom1");

    }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2013 May 06, 2013

Thank you so much thats fixed it

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 06, 2013 May 06, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines