Flash Game Design  
 
Flash Tutorials Photoshop Tutorials Flash Games  
This Flash tutorial will show you how to create buttons using xml for the text.
 
Step 1.
XML allows the seperation of content from functionality. Amongst other things, it allows you to update the content without having to open Flash up and wade through all the code (in this case the actionscript). So, first of all we need to create the XML file, so open up any text editor, such as notepad. Enter the following code, which will be explained below.
 
Code Explanation:

Line 1: Declares the version of XML

Line 2: A tag is created, which will be used to describe what the xml is being used for (menu).

Line 2-8 : For each menu item, we create a tag, with a unique "buttonName" attribute. The quotes around each item indicate that they are text. Each node is end with a closing tag />

Line 9 : The menu tag is closed. Save the file is menu.xml

Step 2.
For this tutorial i've create a simple layout, which we will attach the menu buttons to. You can download the FLA for this here. The template is on a layer called "bg".
 
Step 3.
Next, create some initial content and then convert it to an MC (Movie Clip Symbol), called "pages". I've just used some large, thick text.
 
 
Step 4.

Double click on the "pages" MC and create some different content, for each of the 6 sections, every 10 frames.

 
Step 5.

Use F7 to create blank key frames every 10 frames, on a new layer called "labels". The labels needs to correspond to each "buttonName" you created in the XML file. To make it nicely organised, if you added about for the first "buttonName", create the about label in the 1st frame. The lables much also be spelt the same as each "buttonName", because we're also going to be using the XML text in a gotoAndStop() action. It's doesn't matter if one has capitals and the other doesn't though.

 
Step 7.
Next, create another layer called "heading", circled in green in the image below. Add some text, using F5 to extend it as far as the last frame of the contact label. The 2 essential aspects of the text are circled in blue and red. The text needs to dynamic which, again, we'll be using the XML text to change it as each button is pressed. Secondly the next needs to be assigned a variable (Var), which will be used to reference the text, in order to apply the change.
 
Step 8.
Go back to the main timeline and, from the properties panel, give the pages MC the instance name "pages". Next go to part two of this flash tutorial.
 
 
 
     
     
 
Top Flash
Create a Spot the Difference Game
Create a Shooter Game
Flash Gallery Tutorial
Flash Website Tutorial
 
 
 
 
 
 
 
Game Websites
Hidden Object Games
Tower Defense Games
Hunting Games
 
 
 
 
 
 
 
 
 
     
Site Copyright © 2006 - 2011 Nick DS. All rights reserved.