Solved

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

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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,…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
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 what frame rate is, how to control it and what effect it has on the video.

732 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