# I need help with the code below

**URL:** <https://forum.kirupa.com/t/i-need-help-with-the-code-below/219061>\
**Category:** Uncategorized\
**Created:** [March 13, 2007, 3:16pm UTC](https://forum.kirupa.com/t/i-need-help-with-the-code-below/219061 "2007-03-13T15:16:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sheena](https://avatars.discourse-cdn.com/v4/letter/s/8e8cbc/32.png) [@sheena](https://forum.kirupa.com/u/sheena)\
**Post date:** [March 13, 2007, 3:16pm UTC](https://forum.kirupa.com/t/i-need-help-with-the-code-below/219061/1 "2007-03-13T15:16:47Z")

</div>

…I have a number of buttons only one is the correct button to press, the user has three chances to get it right each mistake displays an error message - on the second error message - “Incorrect, please try again following the diagram below” - I need to display a diagram but I don’t know how to set this up using the existing code below. Can anyone advice me how to achieve this or point me the right direction? Your help as always very much appreciated.

* * *

stop();  
var right\_btn = 4;  
var message\_1 = “Incorrect, please try again”;  
var message\_2 = “Incorrect, please try again following the diagram below”;  
var message\_3 = “Incorrect, please try again or click here to return to the demo”;  
var m = 0;  
for (var i = 1; i\<=5; i++) {  
var btn = this[“btn”+i];  
btn.id = i;  
btn.onPress = function() {  
if (m\<3) {  
m++;  
}  
if (this.id !== right\_btn) {  
_root.errorPanel.info.text = eval("message_"+m);  
} else {  
nextFrame();  
}  
};  
}
