Flasher Archive
[Previous] [Next] - [Index] [Thread Index] - [Previous in Thread] [Next in Thread]
Subject: | XML Handling in Flash 5 |
From: | Daryn Nakhuda |
Date: | Sun, 04 Feb 2001 01:59:34 -0000 |
> You still have to move the contents of the 'nice xml file'
> into variables for Flash to use them right? If I'm wrong
> tell me the alternative, but I will work with this assumption.
you don't actually have to move each thing from the xml file into variables
per se.
data = new XML();
data.load("thefile.xml");
which gives you an XML object containing the xml from the file.
items=xmldoc.childNodes
is the array of the xml child nodes
attribs=items[i].attributes
is the array of the fields(author,title,etc..) for that particular item.
I then have functions to sort, display, scroll, filter etc using those
arrays.
currentlist = buildList(items);
currentlist.sortList(field);
currentlist.filter(field,filter);
etc...
and if i want to add another field from the display stuff, I just have to
tweak an array I have of the fieldnames, modify my row mc to have a text
field of that name, and add a couple buttons w/ function calls, and that's
it.
true, you could loop through the variables
author1,artist1,title1,author2,artist2,title2 like you suggested, and read
them into arrays and do the same thing, but I think the above works pretty
nice.
You're absolutely right, it won't work with flash 4.. In my example, that's
okay; the site is not a commerce site or anything that needs to be 100%
accessible, so I'd rather be technologically interesting, and if they don't
want to install the new plugin, they don't get to see the work :(
oh, one other thing:
about the file size being smaller if you don't use xml: you can do a
preloader while loading the xml using the loaded() function; which you can't
really do with loading variables.
-daryn
[Previous] [Next] - [Index] [Thread Index] - [Next in Thread] [Previous in Thread]