the_frog
01-06-2009, 10:56 AM
Hi!
I have tried to create a simple Hangman game, it works great,:) 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.:confused: Number 2 Preferably I would like the program, alternating between several different words. How do I do? Some kind of array? :o Please can someone help a woman in need? ;)Maybe I better say that I am a beginner at actionscript to. This is the code as it looks today.
stop();
okey._visible=false;
akey._visible=false;
pkey._visible=false;
rkey._visible=false;
r2key._visible=false;
skey._visible=false;
wkey._visible=false;
var wrongletters:Array=["b","c","d","e","f","g","h","i","j","k","l","m","n","q","t","u","v","x","y","z"];
for (i=0; i<wrongletters.length; i++) {
my_btn=_root[wrongletters[i]+"_btn"];
my_btn.onRelease=function() {
nextFrame();
this._visible=false;
};
}
s_btn.onRelease=function() {
skey._visible=true;
this._visible=false;
checkAnswers();
};
p_btn.onRelease=function() {
pkey._visible=true;
this._visible=false;
checkAnswers();
};
a_btn.onRelease=function() {
akey._visible=true;
this._visible=false;
checkAnswers();
};
r_btn.onRelease=function() {
rkey._visible=true;
r2key._visible=true;
this._visible=false;
checkAnswers();
};
o_btn.onRelease=function() {
okey._visible=true;
this._visible=false;
checkAnswers();
};
w_btn.onRelease=function() {
wkey._visible=true;
this._visible=false;
checkAnswers();
};
function checkAnswers() {
if(skey._visible && pkey._visible && akey._visible && rkey._visible && r2key._visible && okey._visible && wkey._visible)
{ gotoAndStop(10);
}
};
I have tried to create a simple Hangman game, it works great,:) 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.:confused: Number 2 Preferably I would like the program, alternating between several different words. How do I do? Some kind of array? :o Please can someone help a woman in need? ;)Maybe I better say that I am a beginner at actionscript to. This is the code as it looks today.
stop();
okey._visible=false;
akey._visible=false;
pkey._visible=false;
rkey._visible=false;
r2key._visible=false;
skey._visible=false;
wkey._visible=false;
var wrongletters:Array=["b","c","d","e","f","g","h","i","j","k","l","m","n","q","t","u","v","x","y","z"];
for (i=0; i<wrongletters.length; i++) {
my_btn=_root[wrongletters[i]+"_btn"];
my_btn.onRelease=function() {
nextFrame();
this._visible=false;
};
}
s_btn.onRelease=function() {
skey._visible=true;
this._visible=false;
checkAnswers();
};
p_btn.onRelease=function() {
pkey._visible=true;
this._visible=false;
checkAnswers();
};
a_btn.onRelease=function() {
akey._visible=true;
this._visible=false;
checkAnswers();
};
r_btn.onRelease=function() {
rkey._visible=true;
r2key._visible=true;
this._visible=false;
checkAnswers();
};
o_btn.onRelease=function() {
okey._visible=true;
this._visible=false;
checkAnswers();
};
w_btn.onRelease=function() {
wkey._visible=true;
this._visible=false;
checkAnswers();
};
function checkAnswers() {
if(skey._visible && pkey._visible && akey._visible && rkey._visible && r2key._visible && okey._visible && wkey._visible)
{ gotoAndStop(10);
}
};