For some reason, the ActionScript I have on two buttons in my game. When the program starts, it goes to the first page, which has two buttons leading to other scenes. Those two buttons work. One of them is a directions button that leads to the directions page. I have another button on my directions page that I want to go back to the title page, the scene with the two buttons. (By the way, I'm using ActionScript 2)
The code I used for the first two buttons:
DirectionsButton.onRelease=function(){
gotoAndPlay("Directions",1);
}
PlayButton.onRelease=function(){
gotoAndPlay("Game",1);
}
---------------------------------------------------------------------- ----------------------
The code I used for the Back button on the Directions scene:
BackButton.onRelease=function(){
gotoAndPlay("Title",1);
}
---------------------------------------------------------------------- -----------------------
For some reason, it's in the exact same format and the exact same way as the other two buttons, but it WILL NOT work. The cursor turns into the hand instead of the arrow, but nothing happens when I click on it. The codes are in the background of each scene, and each of them are buttons. Two of them work, but the other doesn't!
It's really annoying, so please help me. Thank you in advance!
As long as the code for the lone button is in the same frame as the button, there shouldn't be a problem with the code you show. You should put a trace() in the lone button's function to see if it is working at all. If it is not, then you might need to check instance names or that the code is in the frame and not on the button. If it does trace, then check that you have a scene named Directions, and maybe a stop() command somewhere in it such that you aren't speeding right thru it without stopping.
I tried what you suggested. It does trace, and I have a scene named Directions, and I also have a stop() command. It still doesn't work. I am a student in a class learning Flash. My teacher doesn't know what's going on. One of my friends did this and it worked, but he only had two scenes. I have three, but it doesn't work. Another one of my friends has the same problem, and also has three scenes.
Not that it's any consolation, but using scenes is not a recommended practice - so if you are only doing it for your coursework, you should plan on forgetting about using them in the future. Thy can be troublesome without reason as you are finding out. Just as a matter of further trial, instead off using just gotoAndPlay("Directions",1); try using _root.gotoAndPlay("Directions",1);
North America
Europe, Middle East and Africa
Asia Pacific