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

Multiple buttons pressed to trigger an event

New Here ,
Dec 07, 2017 Dec 07, 2017

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!

TOPICS
ActionScript

Views

304

Translate

Translate

Report

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 ,
Dec 07, 2017 Dec 07, 2017

Copy link to clipboard

Copied

LATEST

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);

}

}

}

Votes

Translate

Translate

Report

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