Solved

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

Posted on 2006-07-10
4
136 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

I know the transition can be hard. We got used to the ease of use ActionScript 2 had, but honestly, it became problematic later on, especially if designers were involved in the project and found it easy to add code as they saw fit. So, this artic…
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 goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to use the auto adjust feature and what the different options do. When your video is not working right you can choose the auto adjust feature to help choose your settings.

746 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

13 Experts available now in Live!

Get 1:1 Help Now