Ask a Question related to Macromedia Flash Data Integration, Design and Development.
-
Laura MS #1
Trouble getting XML data to display
I'm having a slight problem getting XML data to read out in dynamic text files.
I'm doing a pretty small experiment here. The XML file loads fine. I just must
be making some small error in how I assign the value of the text fields to the
values in the XML file. Can anyone please tell me my error? I am using Flash
CS3 and ActionScript 3.
I have a simple XML file:
<?xml version="1.0" encoding="utf-8"?>
<primary>
<state>Montana</state>
<race_type>primary</race_type>
</primary>
In my .fla, I have a dynamic text field with an instance name of State_name. I
have another dynamic text field with an instance name of Type_race.
Then, in my .fla, I have this code:
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, onLoadXML);
loader.load(new URLRequest("dems.xml"));
function onLoadXML(ev:Event) {
try {
var myXML:XML = new XML(ev.target.data);
var list:XMLList = myXML.primary;
State_name.text = list.state;
Type_race.text = list.race_type;
}
catch (e:TypeError) {
trace("Could not parse the XML");
trace(e.message);
}
}
stop();
Laura MS Guest
-
display data points but not data tips
does anyone know how to display the data point, but not the data tip? i just want to display the circular node that shows where the data point is,... -
How to display a set of data in a data grid when drivenby a combo box?
I am trying to build a page where the user can select a syle of food (i.e. chinese, italian etc) from a combo. I would then want the relevent... -
Trouble inserting data in database
I use DW 2004, XP with sp2, and Access 2003. Im planning to make a site that is possible to log in and update news from the web. So I have made a... -
Data::Dumper trouble
Hi all, I want to store some complex data. My first solution made use of Storable, which worked just fine. Now I learned that neither Storable nor... -
Display data from database in a scrollable data grid on an ASP Page
Hi All, I want to display data from database in a scrollable data grid on an ASP Page. I want to use it for entering data also. Should i have to... -
The Feldkircher #2
Re: Trouble getting XML data to display
Hi
Have you tried to trace(list.state) and trace(list.race_type) if they return
undefined then your variable references are wrong.
If this is OK and you get correct node data, then try embeding a font on your
dynamic textboxes.
You never know, strange things can happen.
Hope it helps
The Feldkircher Guest
-
Laura MS #3
Re: Trouble getting XML data to display
Hi,
I dispensed with the list altogether and just used the XML object:
var myXML:XML = new XML(ev.target.data);
Then I refer to nodes in the XML like this:
myXML.statename[i]
I'll keep working on this so that I can iterate through the nodes in my XML
file without having to state them by name, but this syntax is working. Thanks!
Laura MS Guest



Reply With Quote

