Hello,
I am building a prototype of a little game and I’m having trouble to make it work.
The game has to work the following:
The player clicks an object and a input field is enabled.
The player fills in the right word in the field and the object disappears (visibility is false).
Below is the code I wrote.
I need to see if the text in the input field is wrong or right. If it is right the objects visibility is set to false otherwise it stays true.
*EDIT: I don’t get any errors, but the object doesn’t disappear.
import flash.events.MouseEvent;
import flash.ui.Keyboard;
stop();
uitleg_mc.visible = false;
olifantje_mc.visible = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyEnter);
help_mc.addEventListener(MouseEvent.CLICK, openUitleg);
olifant_mc.addEventListener(MouseEvent.CLICK, olifantje);
function openUitleg (e:MouseEvent) {
if (uitleg_mc.visible == false){
uitleg_mc.visible = true;
}
else{
uitleg_mc.visible = false;
}
}
function olifantje (e:MouseEvent) {
olifantje_mc.visible=true;
}
function onKeyEnter (e:KeyboardEvent){
if (olifantje_mc.text == 'olifantje'){
olifant_mc.visible=false;
}
else {
olifant_mc.visible=true;
}
}
Hopefully this is clear and someone can help me