# Problems with hangman game

**URL:** <https://forum.kirupa.com/t/problems-with-hangman-game/278822>\
**Category:** flash\
**Created:** [January 6, 2009, 10:56am UTC](https://forum.kirupa.com/t/problems-with-hangman-game/278822 "2009-01-06T10:56:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![the\_frog](https://avatars.discourse-cdn.com/v4/letter/t/bbe5ce/32.png) [@the\_frog](https://forum.kirupa.com/u/the_frog)\
**Post date:** [January 6, 2009, 10:56am UTC](https://forum.kirupa.com/t/problems-with-hangman-game/278822/1 "2009-01-06T10:56:26Z")

</div>

[FONT=&quot]Hi!  
I have tried to create a simple Hangman game, it works great,[/FONT]:pleased:[FONT=&quot] but I have two problems. Number one, the course I´m taking requires that there should be an if else statement in the actionscript programming (in an appropriate manner in connection with the user interaction) and I realy don’t know how to fix that. I´m tearing my hair. [/FONT]:crying: [FONT=&quot]Number 2 Preferably I would like the program, alternating between several different words. How do I do? Some kind of array? [/FONT]😊 [FONT=&quot]Please can someone help a woman in need? [/FONT]:hang:[FONT=&quot] Maybe I better say that I am a beginner at actionscript to. This is the code as it looks today.[/FONT]

[FONT=&quot]stop();[/FONT]  
[FONT=&quot]okey.\_visible=false;[/FONT]  
[FONT=&quot]akey.\_visible=false;[/FONT]  
[FONT=&quot]pkey.\_visible=false;[/FONT]  
[FONT=&quot]rkey.\_visible=false;[/FONT]  
[FONT=&quot]r2key.\_visible=false;[/FONT]  
[FONT=&quot]skey.\_visible=false;[/FONT]  
[FONT=&quot]wkey.\_visible=false;[/FONT]

[FONT=&quot]var wrongletters:Array=[“b”,“c”,“d”,“e”,“f”,“g”,“h”,“i”,“j”,“k”,“l”,“m”,“n”,“q”,“t”,“u”,“v”,“x”,“y”,“z”];[/FONT]  
[FONT=&quot]for (i=0; i\<wrongletters.length; i++) {[/FONT]  
[FONT=&quot] my\_btn=\_root[wrongletters\*+“\_btn”];[/FONT]  
[FONT=&quot] my\_btn.onRelease=function() {[/FONT]  
[FONT=&quot] nextFrame();[/FONT]  
[FONT=&quot] this.\_visible=false;[/FONT]  
[FONT=&quot] };[/FONT]  
[FONT=&quot]}[/FONT]

[FONT=&quot]s\_btn.onRelease=function() {[/FONT]  
[FONT=&quot] skey.\_visible=true;[/FONT]  
[FONT=&quot] this.\_visible=false;[/FONT]  
[FONT=&quot] checkAnswers();[/FONT]  
[FONT=&quot]};[/FONT]

[FONT=&quot]p\_btn.onRelease=function() {[/FONT]  
[FONT=&quot] pkey.\_visible=true;[/FONT]  
[FONT=&quot] this.\_visible=false;[/FONT]  
[FONT=&quot] checkAnswers();[/FONT]  
[FONT=&quot]};[/FONT]

[FONT=&quot]a\_btn.onRelease=function() {[/FONT]  
[FONT=&quot] akey.\_visible=true;[/FONT]  
[FONT=&quot] this.\_visible=false;[/FONT]  
[FONT=&quot] checkAnswers();[/FONT]  
[FONT=&quot]};[/FONT]

[FONT=&quot]r\_btn.onRelease=function() {[/FONT]  
[FONT=&quot] rkey.\_visible=true;[/FONT]  
[FONT=&quot] r2key.\_visible=true;[/FONT]  
[FONT=&quot] this.\_visible=false;[/FONT]  
[FONT=&quot] checkAnswers();[/FONT]  
[FONT=&quot]};[/FONT]

[FONT=&quot]o\_btn.onRelease=function() {[/FONT]  
[FONT=&quot] okey.\_visible=true;[/FONT]  
[FONT=&quot] this.\_visible=false;[/FONT]  
[FONT=&quot] checkAnswers();[/FONT]  
[FONT=&quot]};[/FONT]

[FONT=&quot]w\_btn.onRelease=function() {[/FONT]  
[FONT=&quot] wkey.\_visible=true;[/FONT]  
[FONT=&quot] this.\_visible=false;[/FONT]  
[FONT=&quot] checkAnswers();[/FONT]  
[FONT=&quot]};[/FONT]

[FONT=&quot]function checkAnswers() {[/FONT]  
[FONT=&quot] if(skey.\_visible && pkey.\_visible && akey.\_visible && rkey.\_visible && r2key.\_visible && okey.\_visible && wkey.\_visible) [/FONT]  
[FONT=&quot]{ gotoAndStop(10);[/FONT]  
[FONT=&quot] }[/FONT]  
[FONT=&quot]};[/FONT]
