Hi!
I’m at the moment programming a game for a so called APU-project.
Working towards a client to deliver an educational game.
Me & five other people are making an educational game and the main game screen is based in a corridor with loads of doors (8 right now).
The problem is, when I type in some code to get a button(the doors) to lead the flashgame to the next frame(or a preferred frame) it doesn’t stop at the frame where I’ve written “stop();”.
The thing is, we have animations for when you click on a door and when you reach it. When you’ve reached the door, you can click it again and it will open and lead you to another frame/Screen. The problem is, when it reaches the frame where it’s supposed to stop infront of the door it just keeps going to the next frame and doesn’t stop even though I’ve written a stop(); command.
I tried to put the stop(); inside a function to get it to stop. I also tried to type stop(); in the beginning of the script but that didn’t help.
How can I fix this problem?
For extra info, the animations are done in frames, and not as scripts, since this didn’t help at all.
And if I use the gotoAndPlay(); instead it just stops at the frame and we can’t use animations in frames,
Here’s the code I’m using atm:
var musDoor1:Boolean = false;
var musDoor2:Boolean = false;
var musDoor3:Boolean = false;
var musDoor4:Boolean = false;
var musDoor5:Boolean = false;
var musDoor6:Boolean = false;
var musDoor7:Boolean = false;
var musDoor8:Boolean = false;
stage.addEventListener(Event.ENTER_FRAME, click1);
stage.addEventListener(Event.ENTER_FRAME, click2);
stage.addEventListener(Event.ENTER_FRAME, click3);
stage.addEventListener(Event.ENTER_FRAME, click4);
stage.addEventListener(Event.ENTER_FRAME, click5);
stage.addEventListener(Event.ENTER_FRAME, click6);
stage.addEventListener(Event.ENTER_FRAME, click7);
stage.addEventListener(Event.ENTER_FRAME, click8);
stage.addEventListener(Event.ENTER_FRAME, stopGame);
door1.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler1);
door2.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler2);
door3.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler3);
door4.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler4);
door5.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler5);
door6.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler6);
door7.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler7);
door8.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler8);
function stopGame(event:Event):void
{
stop();
}
function click1(event:Event):void
{
if(musDoor1 == true)
{
nextFrame();
}
}
function click2(event:Event):void
{
if(musDoor2 == true)
{
gotoAndPlay(17);
}
}
function click3(event:Event):void
{
if(musDoor3 == true)
{
gotoAndPlay(18);
}
}
function click4(event:Event):void
{
if(musDoor4 == true)
{
gotoAndPlay(19);
}
}
function click5(event:Event):void
{
if(musDoor5 == true)
{
gotoAndPlay(20);
}
}
function click6(event:Event):void
{
if(musDoor6 == true)
{
gotoAndPlay(21);
}
}
function click7(event:Event):void
{
if(musDoor7 == true)
{
gotoAndPlay(22);
}
}
function click8(event:Event):void
{
if(musDoor8 == true)
{
gotoAndPlay(23);
}
}
function mouseDownHandler1(e:MouseEvent):void
{
musDoor1 = true;
}
function mouseDownHandler2(e:MouseEvent):void
{
musDoor2 = true;
}
function mouseDownHandler3(e:MouseEvent):void
{
musDoor3 = true;
}
function mouseDownHandler4(e:MouseEvent):void
{
musDoor4 = true;
}
function mouseDownHandler5(e:MouseEvent):void
{
musDoor5 = true;
}
function mouseDownHandler6(e:MouseEvent):void
{
musDoor6 = true;
}
function mouseDownHandler7(e:MouseEvent):void
{
musDoor7 = true;
}
function mouseDownHandler8(e:MouseEvent):void
{
musDoor8 = true;
}