

- #Flash actionscript 3.0 not stopping with stop command on last frame how to
- #Flash actionscript 3.0 not stopping with stop command on last frame movie
- #Flash actionscript 3.0 not stopping with stop command on last frame update
- #Flash actionscript 3.0 not stopping with stop command on last frame registration
Creating Level TwoĬreating level two involves editing each of the container objects inside the main background, and adding a second frame to their timelines. That’s all we need to do right now with these objects. (One little detail you might notice from the above image is that I set the x and y location of the object container to be (0,0), and then adjusted the relative positions of the door and the key to keep them in the correct locations.)
#Flash actionscript 3.0 not stopping with stop command on last frame registration
Set its registration to the lower left, and gave it the instance name “ other“.
#Flash actionscript 3.0 not stopping with stop command on last frame movie
So after double-clicking on the main background object, select everything on the “Other” layer (which should just be the lockedDoor and the doorKey objects), and then convert them to a new Movie Clip ( Modify –> Convert to Symbol). I named mine “Background Other Objects Container”. In order for the multiple-level code to work, we are going to “nest” the key and the door inside a container Movie Clip, just like we did with the visuals layer, and the collisions layer.
#Flash actionscript 3.0 not stopping with stop command on last frame update
Creating the Container for the Other Background Objectsįirst, we need to update the “Other” layer from the last tutorial, in which we placed the key and the door. And once again, we need to go back to the drawing board and modify the background. It seems that we’ve been spending most of each recent tutorial just setting up the visual components of the game… this isn’t true for most games, but because we are creating an “art-based” platformer, there is really no way around it. Finally, we will reset any level-specific variables and settings, such as the doorOpen and ke圜ollected variables.Then we will reset the scrollX and scrollY variables to move the player to the beginning of the next level.To switch levels, we will gotoAndStop() to the appropriate frames inside the back.visuals container-object, the llisions container object, and also the back.other container-object, which we still need to create (this will hold the door and key).When the player opens the door, he can press the down arrow key to enter the door and proceed to the next level.

We are essentially doing the same thing with each of the layers of the background. Last tutorial, we were able to give the locked door multiple image states by using the frames on its animation timeline. We are going to use multiple frames inside the background object to hold different levels. I’m going to stick with the simplest solution I’ve come up with so far. There are tons of different ways to accomplish what we are trying to achieve - some more complicated than others. “How?”, you might ask… just read on to see the magic unfold.īefore we dive head-first into things, let’s take a moment to plan out the structure of the platformer. Press the down arrow key upon opening the door to warp to the next level:Īfter adding the door and key last time, the next step is to make the door lead to the next level.
#Flash actionscript 3.0 not stopping with stop command on last frame how to
I duplicated a Container2 with a MovieClipwith 3 frames, but stop() on the last 2 only to show what I was talking about as a solution(?).Here’s the post you’ve all been waiting for… how to connect multiple levels in your platformer!

I've placed one of the Container onto the stage and when the button is clicked, it'll add Container (again) and Container2 onto the stage as well. Container has a nested movieclip with 2 frames, a stop() on each. I've made a simple Test.fla to show how the issue can be reproduced.īasically, there's a button to add the container from the library. Now, the question here is, why does this happen? I solved it by adding an extra frame before the first stop(), it works and tracing shows that I'm on the first stopped frame. When tracing in the frames, I found that the first frame has been skipped, none of the trace from the first frame showed up and went straight to the second. However if I were to add to the stage dynamically with addChild(), it won't. If I were to drag the MC manually onto the stage, the stop() method would work and stop at the first frame.

I was able to duplicate this issue with a nested MovieClip with just 2 frames.
