Hi i want to use this class on my project:
http://www.nuff-respec.com/technology/sort-xml-by-attribute-in-actionscript-3
I know how to import it but then ive got some problems. As ive posted some time ago i use xml with this structure:
[AS]<?xml version=“1.0” encoding=“utf-8”?>
<GALLERY XPOSITION=“5” YPOSITION=“5” WIDTH=“100” HEIGHT=“100”>
<IMAGE FULL=“full_images/image1.jpg” THUMB=“thumbs/thumb1.jpg” />
<IMAGE FULL=“full_images/image2.jpg” THUMB=“thumbs/thumb2.jpg” />
<IMAGE FULL=“full_images/image3.jpg” THUMB=“thumbs/thumb3.jpg” />
<IMAGE FULL=“full_images/image4.jpg” THUMB=“thumbs/thumb4.jpg” />
<IMAGE FULL=“full_images/image5.jpg” THUMB=“thumbs/thumb5.jpg” />
<IMAGE FULL=“full_images/image6.jpg” THUMB=“thumbs/thumb6.jpg” />
<IMAGE FULL=“full_images/image7.jpg” THUMB=“thumbs/thumb7.jpg” />
<IMAGE FULL=“full_images/image8.jpg” THUMB=“thumbs/thumb8.jpg” />
<IMAGE FULL=“full_images/image9.jpg” THUMB=“thumbs/thumb9.jpg” />
<IMAGE FULL=“full_images/image10.jpg” THUMB=“thumbs/thumb10.jpg” />
<IMAGE FULL=“full_images/image11.jpg” THUMB=“thumbs/thumb11.jpg” />
<IMAGE FULL=“full_images/image12.jpg” THUMB=“thumbs/thumb12.jpg” />
<IMAGE FULL=“full_images/image13.jpg” THUMB=“thumbs/thumb13.jpg” />
<IMAGE FULL=“full_images/image14.jpg” THUMB=“thumbs/thumb14.jpg” />
</GALLERY>[/AS]
in first frame ive got:
var xml:XML = New XML();
xml.load("gallery.xml");
// original XML object
trace("BEFORE:" + xml);
XMLUtils.sortXMLByAttribute(
xml,
'THUMB'
);
trace("After:" + xml);
XMLUtils.sortXMLByAttribute(
xml,
'THUMB',
Array.NUMERIC
);
trace("Array.NUMERIC:" + xml);
//multiple options not don't modify orginal
var reverseXML:XML = XMLUtils.sortXMLByAttribute(
xml,
'THUMB',
Array.NUMERIC | Array.DESCENDING,
true
);
trace("Array.NUMERIC | Array.DESCENDING:" + reverseXML);
I know that I must load from xml to array data I i tried sth like that:
var A:Array = new Array();
var XML_var:XML = new XML();
XML_var.load("gallery.xml");
XML_var.onLoad = loadImages;
function loadImages() {
for(var i=0; i<XML_var.firstChild.childNodes.length; i++){
imageList.push(XML_var.firstChild.childNodes*)
}
but there is probably un error somewhere. I want to load on stage 3 LAST ADDED thumbs so ive thought that this will work[AS]for(var i:uint = A.length - 3; i < A.length ; i++){
addChild(“wynik”);[/AS]but to be honest i dont know how to this together;/ how to stick this codes;/?