I have 3 layers in the timeline, and I want to make a new layer, and then use the new layer to be my first frame (like a startpage开发者_运维知识库). How do I do that?
Flash does not support show/hide of layers. Learn about working with Movieclips. You should find a lot by just searching for it.
myStartClip.visible = true;
A "shaking screen" means you probably have compile errors.
Don't use layers or frames (aside from the first frame where you put all your code as usual of course). It's an AS3 exercise, which means you should be working mainly in AS3 code, and not in frames and layers.
You put the "start page" in a container, which can be a Sprite or a MovieClip. The "start page" can contain for instance a background, a textfield with some instructions and a start button.
This means that you have to create a new container for instance
var startContainer:Sprite = new Sprite();
addChild(startContainer); // and maybe position it with x and y
Then you create the things you need on your start page
var infoTf:TextField = new TextField();
infoTf.text = "some game description and how to play";
var bg:SomeBackground = new SomeBackground();
var startBtn:SomeBtn = new SomeBtn();
startBtn.addEventListener(MouseClick.CLICK, handleMClick_startGame);
And then you add these things to the container.
startContainer.addChild(bg); // add the other things too of course
Then when you press the startBtn, you use removeChild on the entire container and don't forget to remove the eventListener for the startBtn
After that you add the content for the game either directly on the stage, or to another mainContainer if you so prefer.
And in the end you use the same technique for the game over page.
精彩评论