Solved

Populating a list component in FLASH via XML FILE...Please Help

Posted on 2007-11-28
1
1,509 Views
Last Modified: 2012-08-14
Hello Experts,

I am trying to learn using XML object within Flash 8. What I would like to do is to populate the list component which is placed on my stage with an XML file. I am almost there but currently getting errors such as:

"class scripts may only define class or interface constructs."

This is my XML FILE within same directory as my AS File:


<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<images>
    <pic>
        <image>One.jpg</image>
        <caption>ONE</caption>
    </pic>
   
    <pic>
        <image>Two.jpg</image>
        <caption>TWO</caption>
    </pic>

    <pic>
        <image>Three.jpg</image>
        <caption>THREE</caption>
    </pic>
</images>
//LOAD XML FUNCTION
 

function loadXML(loaded){

	if(loaded){

	xmlNode = this.firstChild;

	list = [];

	total = xmlNode.childNodes.length;

	for(i=0; i<total; i++){

		list[i]= xmlNode.childNodes[i].childNodes[0].firstChild.nodeValue;

		}

	}
 

}
 

// MY XML OBJECT

xmlData = {}; //XML OBJECT

xmlData.ignoreWhite = true;

xmlData.onLoad = loadXML; //THIS IS WHERE LOAD XML FUNC GETS CALLED

xmlData.load("images.xml"); //PATH TO MY XML FILE

Open in new window

0
Comment
Question by:combustion007
1 Comment
 
LVL 18

Accepted Solution

by:
Antonio Estrada earned 125 total points
ID: 20393866
Switch the line

xmlData = {}; //XML OBJECT

with this:

var xmlData:XML = new XML(); //XML OBJECT

-V
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

I come across a lot of question about how to access things in the document class from a movieclip, or accessing something from a movieclip in the document class. It took me a while to figure this out but once I did it makes life so much easier. …
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.
The goal of the tutorial is to teach the user what frame rate is, how to control it and what effect it has on the video.

919 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

19 Experts available now in Live!

Get 1:1 Help Now