Copy link to clipboard
Copied
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
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");
}
}
Copy link to clipboard
Copied
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");
}
}
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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");
}
}
Copy link to clipboard
Copied
Thank you so much thats fixed it
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now