Solved

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

Posted on 2006-07-10
4
141 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

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…
The last time I worked with Flash and Socket connections was in AS1. A recent project required flash connecting to a Socket, and sending receiving information - we figured it would be easy enough - we all know about the socket policy documents and c…
In this tutorial viewers will learn how to create a basic motion tween animation in Flash Open a new document in Flash: Draw/import an image: Press CTRL + F8 to convert it into a graphic symbol: Select a frame (how long you want the tween to last): …
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…

734 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