Solved

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

Posted on 2007-11-28
1
1,518 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

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…
Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
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 live broadcast using Flash Media Live Encoder and connecting it to YouTube to broadcast. Log into your Youtube account, choose live stream settings, start live stream from Flash Media Live Enc…

770 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