Using XML

The slideMenuAS3 items can also be defined using an external XML file. This option can be used instead of defining the icons through the Component Inspector or through ActionScript.


1. Open your favourite plain text editor (for example Notepad on Windows or TextEdit on Mac) and start a new file.

2. Begin your file with the following line:

<?xml version="1.0" encoding="utf-8"?>

This is the standard xml declaration.

 

3. Add the following lines to your xml file. (The bold lines are the new additions)

<?xml version="1.0" encoding="utf-8"?>    
<flashloaded>
</flashloaded>

4. Add configuration parameters

<?xml version="1.0" encoding="utf-8"?>    

<flashloaded>

   <menu>
         <iconSource>images/home.jpg</iconSource>
         <title>Title0</title>
         <action>getURL("http://flashloaded.com")</action>
   </menu>

   <menu>
         <iconSource>images/about.jpg</iconSource>
         <title>Title1</title>
         <action>gotoAndPlay(2)</action>
   </menu>

   <menu>
         <iconSource>Symbol2</iconSource>
         <title>Title2</title>
         <action>gotoAndStop(3)</action>
   </menu>

   <menu>
         <iconSource>Symbol3</iconSource>
         <title>Title3</title>
         <action>getURL("http://adobe.com")</action>
   </menu>

   <menu>
         <iconSource>Symbol4</iconSource>
         <title>Title4</title>
         <action>getURL("http://microsoft.com")</action>
   </menu>


</flashloaded>

 

 iconSource The class name for movie clip icons or the path and file name to an external image.

 title The title that you would like to appear under the icon.

 action The action to perform upon clicking the icon.



5. Save the XML file to the same folder as your Flash file.


6. Return to your Flash file. Enter the name and path to the XML file that you just created in the xml path parameter of the slideMenuAS3 that's on the stage.

Note: If your .swf file will be in a different folder to the HTML file in which it is embedded, you should enter the path to the XML file, relative to the location of the .swf file.


7. Press Ctrl+Enter (Win) or Cmnd+Enter (Mac) to test your movie.