Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2006-07-10
4
Medium Priority
?
143 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 1000 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 1000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

This article describes a solution to a problem of subloading one movie into another when they have different SWF versions. Sometime back, I was working on an ActionScript project while I came across an interesting fact which I would like to share…
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 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…
This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.
Suggested Courses

670 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