Hi guys!
My XML looks like this with afew more <item> tags.
<items>
<item>
<name>a name</name>
<image source="http://www.domain.com/images/image0.jpg" thumb="http://www.domain.com/thumbs/image0.jpg">description</image>
<image source="http://www.domain.com/images/image1.jpg" thumb="http://www.domain.com/thumbs/image1.jpg">description</image>
<image source="http://www.domain.com/images/image2.jpg" thumb="http://www.domain.com/thumbs/image2.jpg">description</image>
<image source="http://www.domain.com/images/image3.jpg" thumb="http://www.domain.com/thumbs/image3.jpg">description</image>
</item>
<items>
And my actionscript which is on the timeline looks like this
var xml:XML;
var XMLloader:URLLoader = new URLLoader();
XMLloader.load (new URLRequest("http://domain.com/data/portfolio.xml"));
XMLloader.addEventListener (Event.COMPLETE, xmlLoaded);
function xmlLoaded (event:Event=null):void
{
xml = XML(event.target.data);
var images:XMLList = xml.item.image;
var _randomArr:Array=uniqueRandoms(16,images.@thumb.length()-1,0,Math.floor);
// Function to get 16 random numbers from images.@thumb.length();
var _random0:Number = _randomArr[0];
var _random1:Number = _randomArr[1];
loader00.source = images.@thumb[_randomArr[0]];
loader01.source = images.@thumb[_randomArr[1]];
loader00.addEventListener (MouseEvent.CLICK, showPicture00);
loader01.addEventListener (MouseEvent.CLICK, showPicture01);
function showPicture00 (event:MouseEvent):void
{
myLoader.source = images.@source[_randomArr[0]];
addChild (myLoader);
myLoader.addEventListener (MouseEvent.CLICK, removeLoader);
myLoader.addEventListener (LoaderEvents.TRANSITION_END, completeHandler);
trace(images.@thumb[_randomArr[0]].parent());
}
function showPicture01 (event:MouseEvent):void
{
myLoader.source = images.@source[_randomArr[1]];
addChild (myLoader);
myLoader.addEventListener (MouseEvent.CLICK, removeLoader);
myLoader.addEventListener (LoaderEvents.TRANSITION_END, completeHandler);
trace(images.@thumb[_randomArr[1]].parent());
}
}
What I want to do is to get all the images.@thumb from the <item> tag it is located in and display them elsewhere. I dont know which item tag to look in since it´s dynamic, so I need to trace parent or something like that.
Basicly trace which <item> it´s a child from and then get the all the @thumbs from that <item>
I hope I´m making any sense here! In the trace statement I get the description text from the thumb, confused there
Anyways, would be very grateful if someone could help me out here
/rundevo