XML is a great way to transfer data back and forth from a server in dynamic Flash applications. You get the benefits of it being easy to work with, easy to edit, and it’s human-readable. However, there are occasionally times when the XML you use can be too much in it’s description of the data, and the file size of your XML balloons, effectively destroying the goal to transfer as little data as possible to speed your network transfers. Large amounts of XML can also eat up your bandwidth.

An example: last year MediaRain was working on a project that used Music XML to display printed scores online. Music XML is huge! The average song used approx. 50KB of XML, with some songs being upwards of 250KB. With other files being loaded in, file sizes needed to be as small as possible.

Enter a Swedish Flash developer who goes by the name of Strille. Strille describes a method for compressing the XML before you send it to Flash, and then decompressing it once you receive it in Flash. The method is described on his site: http://www.strille.net/tutorials/FlashXMLCompressor/index.php

It really is as easy as copying and pasting the code into the first frame of your .FLA. After that, you can use the XMLObject() as you normally would.

We used this method in our project and it made a huge difference in the transfer times of some of the songs. However, this method does have some disadvantages. If you try to compress a very large file, the decompression in Flash can be pretty processor-intensive at times. You’ll need to test your application and see how it goes on various platforms to determine if the extra processor use is worth it.