Start learning with our library of video tutorials taught by experts. Get started
Viewers: in countries Watching now:
Join Lee Brimelow in this project-style course that teaches how to build a Flash-based game with Flash Builder 4.6, Flash Player 11, and the Starling framework. Starling, a pure ActionScript 3.0 library for advanced graphics, extends Flash Player 11's support for the modern GPU (graphic processing unit) to enable visual presentations and games in the browser or as a mobile app.
Starting with installation and configuration of Starling and creation of a Flash Builder project, the course shows how to prepare and import graphical assets, create MovieClip classes from sprite sheets, manage various gaming objects, detect collisions, and add both particle and sound effects. The finished game can be deployed to any browser or mobile device that integrates Flash Player 11, which was released in September 2011.
So now we have our menu state essentially completed. The last thing we have to do is remember that for each state when we change the state it's first going to call this destroy method, so that our state can actually clean up itself, because again, we want to remove all of the things from the display list, because we don't want to be taking up memory while a different state is happening. So let's fill in this destroy method now. So there's some nice helpful methods that are in Starling that are not in the traditional Flash display list API.
And one of them is a method called removeFromParent. So the first thing I'm going to do is to remove the background, so I can say background, and then call the removeFromParent method, and I can pass in true if I want it to also be disposed, and that will do things like unregister any event listeners that have been registered, so we're going to pass in true there. And now to make sure we totally clean up, I'm also now going to set background = null.
So we're going to do the same thing for the logo, so logo.removeFromParent, put in true, because we want to dispose it, and let's set logo = null. And lastly let's do the play button, so we'll do play.removeFromParent(true); and we'll also set it to null. When we change the state to the play state, the first thing that's going to happen is this destroy method will be called and we can actually dispose of it properly.
Now the last thing we need to do is to get rid of the menu state itself, remove itself from the game's display list, and here we can use the removeFromParent method and pass in true. So this is a really handy method to be able to have in order to help you easily manipulate the display list. Let's go ahead and test it now. We can see it's launched up, and when I click PLAY GAME, everything has disappeared, because again the menu state has removed itself, but remember now the play state doesn't have any visuals on it whatsoever.
So in the next chapter we're going to be building out that play state, which is going to contain all of our actual game play.
There are currently no FAQs about Building Flash Games with Starling.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.