-
Fun XML...
Hi, I would really like some help with this code which has given me a HUGE headache...
This is my xml structure.
Code:
<gallery name="UK">
<picture>
<pictureName>Picture One</pictureName>
<pictureURL>pictures/1.jpg</pictureURL>
<pictureDesc>Taken In France</pictureDesc>
</picture>
</gallery>
<gallery name="France">
<picture>
<pictureName>Picture One</pictureName>
<pictureURL>pictures/1.jpg</pictureURL>
<pictureDesc>Taken In France</pictureDesc>
</picture>
</gallery>
<gallery name="Africa">
<picture>
<pictureName>Picture One</pictureName>
<pictureURL>pictures/1.jpg</pictureURL>
<pictureDesc>Taken In France</pictureDesc>
</picture>
</gallery>
THis is the structure at the moment but if it needs to change it can...
So, in flash i need to see how many galleries there are, i can do this.
I then need to create mc and add them to the stage with the text field insside of them saying what the gallery is called (the attribute) that bit i can also do. The problem then is i need to be able to click the button of the gallery and it loads all of the picture URLs for that gallery but i cant work out how to do that....
This is my flash code at the moment.
Code:
public function galleryNames():void
{
for each (var gallery:XML in xml.gallery)
{
var galleryArray:Array = createGallery(gallery);
for (var i = 0; i<galleryArray.length; i++)
{
galleryHolder_mc.in_mc.addChild(galleryArray[i]);
galleryArray[i].x = 0;
galleryArray[i].y = galleryTotal;
galleryTotal += galleryTotal2;
galleryTotal2 = 0;
trace(galleryArray);
}
}
TweenLite.to(galleryHolder_mc.in_mc, 0.8, {x: 0, ease:Quart.easeOut, overwrite:false});
}
private function createGallery(menu:XML):Array
{
var galleryArrays:Array = new Array();
var galleryItem:emptyGallery = new emptyGallery();
galleryItem.mouseChildren = false;
galleryItem.buttonMode = true;
galleryItem.in_mc.txt_txt.text = menu. @ name;
galleryTotal2 = (galleryItem.height + 5);
galleryArrays.push(galleryItem);
galleryItem.name = menu. @ name;
galleryItem.addEventListener(MouseEvent.CLICK, galleryClick);
return galleryArrays;
}
public function galleryClick(e:MouseEvent):void
{
clickedGallery = e.target.name;
TweenLite.to(thumbNames_mc.in_mc, 0.8, {x: 0, ease:Quart.easeOut, overwrite:false});
TweenLite.to(backPic_mc.in_mc, 1.4, {x:0, ease:Quart.easeOut, overwrite:false});
}
Thanks for your time - please help! =-)
Chris