Hi!
I’m making a small animation with clickable elements for a friend and I’m having some problems.
The “inv” variable is set to 0 from the beginning, and when it changes to 1, a movieclip named “key” is supposed to show up.
Somehow I can’t seem to be able to do this. First I tried to set it on various locations on the timeline - that didn’t work. Then I tried to do it directly into the event listener - that didn’t work either. What am I doing wrong? Here’s the code that goes into the first frame:
//stop film
stop();
//key
var inv:Number = 0;
if (inv == 0) {
key.visible = false;
}
else {
key.visible = true;
}
knob.addEventListener(MouseEvent.MOUSE_UP, onDoor, false, 0, true);
function onDoor (e:MouseEvent):void {
gotoAndPlay("smallRoom");
inv ++;
}
badKnob.addEventListener(MouseEvent.MOUSE_UP, onBadDoor, false, 0, true);
function onBadDoor (e:MouseEvent):void {
gotoAndPlay("badDoor");
}
trace(inv);