Start learning with our library of video tutorials taught by experts. Get started
Viewed by members. in countries. members currently watching.
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 that we've created our main sprite sheet in TexturePacker, we need to use both the PNG and the XML file to create a texture atlas, so that we can reference those assets in Starling. So I'm going to come into my asset class right under where I created or embedded the sky.png and we need to embed both that atlas.png and also the atlas.xml. So I'm going to start with the PNG. So Embed source and that is assets/atlas.png and I'm going to create a private static variable which is going to hold a class variable so we can instantiate that.
So it's going to be private static var and I'm just going to call it atlas. Now when we create our texture atlas, I want to create that as a public static variable, so that we can actually reference it from anywhere we want in our game. So I'm going to create another variable here public static var, and I'm going to call it ta for TextureAtlas, and this is going to be of type TextureAtlas. So now I need to embed that XML file. So it's going to be a similar thing, I'm going to say Embed (source="assets/atlas.xml", but the difference is when we are dealing XML files is we also have to set the mime type to application octet stream, so let me do that now.
mimeType="application/octet-stream") and now we're going to create a private static variable called atlasXML. So now I have both the PNG and the XML embedded and I also have that public static variable, which is going to hold my TextureAtlas. Now I'm going to come down into the init function and instantiate that. So I'm going to instantiate the ta variable, is equal new TextureAtlas, and to this we need to pass in the texture that we're going to create from that PNG, and also the XML file.
So we're going to use the Texture.fromBitmap factory method and we're going pass in a new instance of atlas, because remember that's the embedded PNG file. Now the next thing we need to pass in is the XML file. When we instantiate atlasXML we are going to need to cast it to an XML object, so we are going to cast it like that and pass in a new atlasXML. So let me close that, close that, and close that.
So I've now instantiated my TextureAtlas, and you'll see as we go through the course, I'm going to easily be able to use this ta variable, and say ta.gettexture and give it a string name for the texture that I want to retrieve, but again, the main benefit of this is I'm not having to embed all of these different images separately causing different network requests, and so on, and so forth. So putting them together into a TextureAtlas, not only makes it a lot easier as you are building your game, but also greatly improves the performance of your game.
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.