Solved

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

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

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Here are some practices and techniques that can be adopted into your Flash/Flex application development process. Note: Not all "performance tips" provide an immediately-recognizable benefit.   This article does not include timing validation data,…
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…

820 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