Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-05-2009, 10:38 AM   #1
ttmt
Member
 
Join Date: Dec 2008
Posts: 70
Default XML Gallery Nav. ?

XML Gallery Nav. ?

Hi all

I'm working on a image Gallery using xml to provide the images and Nav.

This a shortened version of how the xml looks

PHP Code:
<portfolio>
   <
fashion>
      <
image source="images/fashion01"/>
      <
image source="images/fashion02"/>
      <
image source="images/fashion03"/>
      <
image source="images/fashion04"/>
      <
image source="images/fashion05"/>
   </
fashion>
   <
portrait>
      <
image source="images/portrait01"/>
      <
image source="images/portrait02"/>
      <
image source="images/portrait03"/>
      <
image source="images/portrait04"/>
      <
image source="images/portrait05"/>
   </
portrait>
   <
editorial>
      <
image source="images/editorial01"/>
      <
image source="images/editorial02"/>
      <
image source="images/editorial03"/>
      <
image source="images/editorial04"/>
      <
image source="images/editorial05"/>
   </
editorial>
   <
travel>
      <
image source="images/travel01"/>
      <
image source="images/travel02"/>
      <
image source="images/travel03"/>
      <
image source="images/travel04"/>
      <
image source="images/travel05"/>
   </
travel>            
</
portfolio
From this xml the gallery will have 4 sections - fashion, portrait, editoral and travel.

I want to pull these sections from the xml and use them as the Navigation (I have buttons in the library with text fields that will be filled with the names of the sections.)

I wanted to then create arrays that contain the references to the images for that section and link them to the buttons - so clicking the fashion button I would have an array that contains the links to the images in the fashion section.

I could do this using AS1 where I would loop through the first tear in the xml giving me fashion, portrait, editorial and travel and then loop again inside that loop to give me the image references to that section.

I've been trying to do the same sort of thing with AS3, but I can only get to the whole the xml to trace

ActionScript Code:
var xml:XML; var xmlList:XMLList; var xmlLoader:URLLoader = new URLLoader(); // xmlLoader.load(new URLRequest("images.xml")); xmlLoader.addEventListener(Event.COMPLETE, xmlloaded); // function xmlloaded(evt:Event):void {     xml=XML(evt.target.data);     xmlList=xml.children();     trace(xmlList);     }

How can I get to the first tear of the xml to give me fashion, portrait, editorial and travel, while I'm doing this link the image references to these.


Can anyone point me in the right direction - Any help appreicated.
ttmt is offline   Reply With Quote
Old 07-05-2009, 12:32 PM   #2
marspark
Member
 
Join Date: Dec 2006
Posts: 58
Default

as3 actually offers a easier way to access xml nodes, you can try

var xmlList:XMLList = portfolio.fashion;
for each (var ele:XML in xmlList) {
trace(ele);
}

to read a complete tutorial, check it here:

http://www.hexosearch.com/se/externa...2fAS3+-+Page+1
marspark is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:11 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.