Copy link to clipboard
Copied
Hi!
so basically im trying to figure out a way so that once two buttons are pressed, it triggers an event.
Im making a hypercomic that will only progress once you find 2 or 3 clickable buttons but once these have been clicked, i want the scene to change.
Thanks!
Copy link to clipboard
Copied
here's one way:
var clickA:Array=[array of buttons that need to be clicked to trigger an action];
var clickedA:Array=[];
for(var i:int=0;i<clickA.length;i++){
clickA.addEventListener(MouseEvent.CLICK,clickF);
}
function clickF(e:MouseEvent):void{
if(clickedA.indexOf(e.currentTarget.name)==-1){
clickedA.push(e.currentTarget.name);
if(clickedA.length==clickA.length){
// trigger action. eg, gotoAndStop(wherever);
}
}
}