Groups | Blog | Home
all groups > flash actionscript > june 2006 >

flash actionscript : XML


Dave
6/25/2006 9:04:34 PM
Hello,

Please could you help to write the actionscript for read this xml ?

Thank very much for your help
---------------------------------------------------------------------------------------------------------
<gallery timer="5" order="sequential" fadetime="2" looping="yes" xpos="0"
ypos="0">

<title="my album"/>

<image path="images/01.jpg" />
<image path="images/02.jpg" />
<image path="images/03.jpg" />
<image path="images/04.jpg" />
<image path="images/05.jpg" />
<image path="images/06.jpg" />
<image path="images/07.jpg" />
<image path="images/08.jpg" />

</gallery>
------------------------------------------------------------------------------------------------------------

NSurveyor
6/25/2006 11:18:49 PM
Use:

<title>my album</title>

and the ActionScript is:

galleryXML = new XML();
galleryXML.ignoreWhite = true;
galleryXML.onLoad = function() {
var n = this.firstChild;
var timer = Number(n.attributes.timer);
var order = n.attributes.order;
var fadetime = Number(n.attributes.fadetime);
var loop = n.attributes.looping == "yes";
var xpos = Number(n.attributes.xpos);
var ypos = Number(n.attributes.ypos);
var title = n.firstChild.firstChild.nodeValue;
var images = [];
for (var m = 1; m<n.childNodes.length; m++) {
images[m-1] = n.childNodes[m].attributes.path;
}
trace(timer);
trace(order);
trace(fadetime);
trace(loop);
trace(xpos);
trace(ypos);
trace(title);
trace(images);
};
galleryXML.load("FILENAME.xml");
AddThis Social Bookmark Button