• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

XML

Even though using loadVariables() to import data (and getURL() to send data to a server) is quite powerful, the limiting factor is how you must format the data. Only name-value pairs are supported, which means you can only import or export variables and their values. Sometimes that is enough, but some types of data are more complex than that (for example, an object with its properties). In addition, the techniques we’ve seen in this chapter require that you carefully plan the structure of such data and stick to it. After all, Flash needs to know which variables are coming in, and a server script needs to know which variables are being sent.

As a format, XML is not very exciting. It’s not supposed to be. It’s only supposed to be standardized so that data structured as XML in one program can be interpreted by another. In Flash, XML is interesting for two reasons. First, because it’s extensible; even after you design a data structure, you can add levels of information without breaking what’s already built. Second, it’s a standard that many applications support. For example, any database program worth its salt can export a database in XML format. The exciting part is that through its extensibility, you can design your XML data to be as complex as necessary. Flash can import XML-structured data, make sense of it (that is, parse out the elements it needs), and also modify or create XML data that can be sent to server applications.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint