It's a simple process and I'll try my best to make it clear. If you need help, feel free to email me (bhbiros@gmail.com) or I can help you in class.
Scene 1:
1.) In scene 1 create a button and give it an instance name of "nextBtn."

2.) Create an actions layer and in that layer put a blank keyframe at the end of your timeline.

3.) Then copy an paste the following actionscript into the blank keyframe you created:
stop();
nextBtn.addEventListener(MouseEvent.CLICK, newScene);
function newScene(event:MouseEvent):void
{
gotoAndPlay("intro", "Scene 2");
}
4.) Finally, go to Scene 2 and create a new layer with 1 blank keyframe at the very beginning of your timeline. Under properties, label this layer "intro." You must do this because in the code a function was create that tells Flash to go to Scene 2 and begin play at "intro." If you do not label a place in Scene 2 for Flash to begin playing, it will not know where to start playing (causing an error).

*This process is then repeated for the all your scenes. HOWEVER, you must give each button you create a different name (i.e. next2Btn, next3Btn, next4Btn) AND you must create a new function name (i.e. newScene2, newScene3, newScene4). FINALLY you must also change the name for the beginning keyframe in each scene (i.e. intro2, intro3, intro4). If you fail to do so, you will receive errors for having duplicate names.
Your code for Scene 2 to jump to Scene 3 should look like this:
stop();
next2Btn.addEventListener(MouseEvent.CLICK, newScene2);
function newScene2(event:MouseEvent):void
{
gotoAndPlay("intro2", "Scene 3");
}
Hope this helps. It sounds more confusing that it really is. Hopefully I made the process clear.
No comments:
Post a Comment