Hi,
I load in my images through xml.
My xml code looks like this for the moment:
I have different sections for my websites gallery. So I have 1 movieclip that is the gallery, and it fills it with the images of a specifice categorie. But how can I reference it?Code:<?xml version="1.0" encoding="UTF-8"?> <portfolio> <categorie naam="artngraphics"> <beeld bestand="images/BilzenRunOntwerp02.jpg"></beeld> <beeld bestand="images/makiGotoWallpaper.jpg"></beeld> <beeld bestand="images/appleAdCampaignEva03.jpg"></beeld> <beeld bestand="images/coverDeKimpel03.jpg"></beeld> <beeld bestand="images/canon_ad_A3ano.jpg"></beeld> <beeld bestand="images/Donum.jpg"></beeld> <beeld bestand="images/INNOGLOBO_teaserkaart.jpg"></beeld> <beeld bestand="images/illustratorMuis.jpg"></beeld> <beeld bestand="images/newbrochurePageCompP1.jpg"></beeld> </categorie> <categorie naam="photography"> <beeld bestand="images/fotoReportageHasselt_02.jpg"></beeld> <beeld bestand="images/benji_spike_effect.jpg"></beeld> <beeld bestand="images/kermis01.jpg"></beeld> <beeld bestand="images/kermis05.jpg"></beeld> </categorie> </portfolio>
When I press a button, it needs to send a string, with the value of the categorie. So if I for example press the button "Photography", it sends the word "photography to the movieclip of the gallery, where the code sits which loads the the images. But how do I tell it to only take the children of that categorie.
This is a part of the code in the movieclip:
You can see that I reserved the string "cat" for it. I don't want reference by numbers like xmlList.categorie[2].children(); or something. But referencing by the words.Code:var xmlLoader:URLLoader = new URLLoader(); xmlLoader.addEventListener(Event.COMPLETE, onLoaded); var xml:XML; var xmlList:XMLList; var xmlLength:int = 0; var imgArray:Array = new Array(); var xImg:Array = new Array(); var imageLoader:Loader; var afb:Sprite; var imgHolder:imgDisplay; var tweenImg:Tween; var tweenScroll:Tween; var scrollStatus:String = "motionFinish"; var cat = "photography"; var i:uint = 0; xmlLoader.load(new URLRequest("xml/portfolio.xml")); function onLoaded(e:Event):void{ xml = new XML(e.target.data); makeImg(); } function makeImg():void{ xmlList = xml.categorie.children(); xmlLength = xmlList.length(); imageLoader = new Loader(); imageLoader.load(new URLRequest(xmlList[i].attribute("bestand"))); imgHolder = new imgDisplay(); addChild(imgHolder); ...etc,...
Hope somebody still has a fresh mind, mine is out for the moment :s.
Cheers.



Reply With Quote