Copy link to clipboard
Copied
What code do I write to create a starting screen for a game? I want to create a screen were if play is clicked it moves on to the game
Copy link to clipboard
Copied
One way of doing it:
Make a MovieClip which contains everything you want to see on the start screen, including the play button.
Add code for the button:
When the button is clicked, then the MovieClip is removed or made unvisible and another MovieClip, containing the game, is added or made visible.
Hope it helps a bit.
Copy link to clipboard
Copied
And the code for the button would be:
EnterScreen.EnterBtn.addEventListener(MouseEvent.CLICK, enterGame);
function enterGame(event: MouseEvent): void
{
EnterScreen.PlayBtn.removeEventListener(MouseEvent.CLICK, enterGame);
removeChild(EnterScreen); //(or EnterScreen.visible = false)
GameScreen.visible = true;
}
where the "EnterScreen" is the name of the startup MoveiClip and the "GameScreen" is the name of the MovieClip which contains the game.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now