XML and Flash : Get yourself some ForX

Monday, June 30, 2008

If there's one class that keeps me coming back to as2 it's ForX (Standing for Formulated XML) by Orion Syndrome : http://www.orionsyndrome.com/.. Ok it's not the most complete class and has it's limitations (multi dimensional XML arrays) but for dealing with simple XML driven flash applications such as galleries, news, tickers and alike it's hard to fault.

So What is ForX .. I will try and explain

  • ForX is a utility class that helps a developer or designer play with XML data in Flash ActionScript 2.0 (no as3 code as yet).
  • Can speed up your work flow, helps you speed up that time costing practice of referencing parent / child nodes
  • The code is simple, clean and works with both attributes and node data

For example ForX allows you to get data simply.. I've taken this example from the PDF manual which comes with the download.

 
/* Basic Dot Path Notation sample
Let’s make a sample XML*/
var xml:XML = new XML('<farm><backyard>
<pighouse>
<pig name="Matilda" />
<pig name="Donald" /></pighouse></backyard>
</farm>');
// We pass that XML to the newly created ForX
var forx:Forx = new Forx(xml);
// First, we try to use getPathNode() method and store that information
var pighouse:XMLNode = forx.getPathNode("farm.backyard.pighouse");
// Next, we try to get the pig node from that pighouse
var pig:XMLNode = forx.getPathNode("pig", pighouse);
// Let’s see what we get
trace(pig);
// Note the casing of the words we used in getPathNode, and it worked!
// Also note that we got only one of the two pigs
// Check the next example for how to get the other pig as well
 

Put simply Forx is a time saver, Lets just hope a as3 version is in the pipeline soon, as this is one class add on no developer designer can afford to miss out on.

If anyone else knows of any other add on for flash regarding XML then please feel free to contact me...

Musing done.

Leave a Reply

In order to submit a comment, you need to mention your name and your email address (which won't be published). And ... don't forget your comment!

Comment Form