Solved

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

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
The goal of the tutorial is to teach the user how to select the video input device. Make sure you have an input device that in connected and work and recognized by Adobe Flash Media Live Encoder and select it in the “video input” menu.
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.

758 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

14 Experts available now in Live!

Get 1:1 Help Now