Solved

loading 6 images,titles, urls from xml and displaying them

Posted on 2006-07-10
4
137 Views
Last Modified: 2010-04-03
i'm new to actionscript, i'm interested in loading some data from my xml file,
and displaying it...
what should i do?

i have an xml file with 6 items:

<item>
<image>http://www.someurl.com/image1.jpg</image>
<title>Some title</title>
<url>http://www.someurl.com</url>
</item>


i want to show them as images, title, and make them link to a url
do i have to create the clips manually, or with actionscript, thanks!
0
Comment
Question by:svsvsv
4 Comments
 
LVL 14

Accepted Solution

by:
trigger-happy earned 250 total points
ID: 17072780
The recommended way to handle xml is by actionscript. The thing is that handling xml files with actionscript can be tedious and tricky but the rewards of flexibility and control outweigh the troubles. I would suggest you look into some tutorials on how to read xml files in flash.

The trick with parsing that kind of xml file would be to loop through all the item elements and grabbing the data you need. This is normally the parsing part or what i call, grab the data. The next part would be to use that data in the way you want. This phase would normally involve loading the images into the respective movie clips, putting the title inside the text box then make use of the link data for the getURL actions.

--trigger-happy
0
 
LVL 3

Assisted Solution

by:BishopNeo
BishopNeo earned 250 total points
ID: 17073606
You can use the XML Class to extrapolate the data you need.  Assume your file is called data.xml (for sake of this discussion), you could do:

var RootNode:XMLNode;
var dXML:XML = new XML();
dXML.ignoreWhite = true;
dXML.onLoad = parseXML;
dXML.load("data.xml");
function parseXML(success:Boolean) {
      if (success) {
            RootNode = this.firstChild;
            for (x:Number = 0; x < RootNode.childNodes.length; x++) {
                  trace(RootNode.childNodes[x].firstChild.nodeValue);
            }
      }
}

Once in the for loop you can put the data into an array if you like and retreive it later.  This is just a starting point, they is a LOT more you can do with the XML data.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
In my long career of working as an actionscript developer, I had spent sleepless night often working hard to solve some small problems which actually took a lot of my development time; later found out the solutions to be a line or two. Here are s…
In this tutorial viewers will learn how to create a basic shape tween animation in Flash including shape hints for smooth animation Open a new document in Flash: Draw a shape: Select another frame (how long you want the tween to be): Right click and…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now