Flash MX 2004 Professional comes with a set of data components that allow you to include external content in your Flash movies. You only have to write one line of code to make these components work. They are very easy to configure using the Component Inspector and you can bind them directly to UI components to create simple applications.
In this tutorial, we'll look at the XMLConnector component. It's a very easy way to connect to external XML files. If you've found using the XML Class a little tricky, then this might be a good alternative for you. The component will certainly save you from having to write long paths like myXML.firstChild.childNodes[2].firstChild.nodeValue every time you want to use a value from an XML file!
We'll use the XMLConnector to create a navigation system. The system will use a ComboBox to select and load a URL. Some people call this a jump menu. The URLs will be stored in an external XML file. That way, we can update the navigation system without having to update the Flash movie.
To create the navigation system, we'll load in the XML file , bind it to a ComboBox component and add an event handler that loads the site. And we'll do all of this in only 8 lines of ActionScript!
You'll learn how to add an XMLConnector to your movie and configure it with the Component Inspector. You'll also learn about binding the XML data to other UI components such as a ComboBox and the List component. We won't cover XML documents because that in included in the earlier tutorials.
This tutorial assumes that you have Flash MX 2004. You can't use any other version of Flash because they don't include the data components we'll need. It also assumes that you have a basic understanding of XML files.
You can download the source files for the tutorial from the blue Properties box that contains the article PDF. There's a heading titled Code Download and you can click the Details link next to it to get the zip file. The download includes the XML files you'll need as as well as the completed files.
Note: If you have difficulties downloading the source files or PDF, you might have a problem with your cookies. Delete the cookies from your machine and try again. In Internet Explorer, you can do this by choosing Tools > Internet Options... and clicking the Delete Cookies... button on the General tab.
Read More