# Check for pressed button and alert if not done

**URL:** <https://forum.kirupa.com/t/check-for-pressed-button-and-alert-if-not-done/149832>\
**Category:** Uncategorized\
**Created:** [June 1, 2005, 6:12pm UTC](https://forum.kirupa.com/t/check-for-pressed-button-and-alert-if-not-done/149832 "2005-06-01T18:12:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirk\_netiq](https://avatars.discourse-cdn.com/v4/letter/k/ee59a6/32.png) [@kirk\_netiq](https://forum.kirupa.com/u/kirk_netiq)\
**Post date:** [June 1, 2005, 6:12pm UTC](https://forum.kirupa.com/t/check-for-pressed-button-and-alert-if-not-done/149832/1 "2005-06-01T18:12:39Z")

</div>

I am using this AS to check to see if a user has pressed all 6 buttons in a tutorial…if they have not then when they try to click on the Next button a hidden alert message will appear reminding the user to press all 6 buttons before continuing:

function checkButton(targ){  
// “targ” refers to the button being pressed  
if (targ.pressed) {  
targ.pressed = true;  
\_root.buttonsPressed += 1;  
} else if (!targ.pressed) {  
targ.pressed = false;  
alert.\_visible = true;  
}  
}

header\_btn.onRelease = function(){  
checkButton(this);  
gotoAndStop(“Header\_area”);  
;  
}

next\_btn.onRelease = function(){  
checkButton(this);  
gotoAndStop(“Training Exercise\_Intro”);  
}

prev\_btn.onRelease = function(){  
checkButton(this);  
gotoAndStop(“Template\_Intro”);  
;  
}

swimlane\_btn.onRelease = function(){  
checkButton(this);  
gotoAndStop(“Swim Lanes”);  
;  
}

numlab\_btn.onRelease = function(){  
checkButton(this);  
gotoAndStop(“Numbering&Labeling”);  
;  
}

seq\_btn.onRelease = function(){  
checkButton(this);  
gotoAndStop(“Sequence”);  
;  
}

shapes\_btn.onRelease = function(){  
checkButton(this);  
gotoAndStop(“Shapes”);  
;  
}

tabs\_btn.onRelease = function(){

gotoAndStop(“Tabs”);  
;  
}

This does not seem to work…Can anyone tell me why?

Thank you.  
 ![](http://www.webwasp.co.uk/forum/images/smiles/icon_biggrin.gif)
