PARSING XML TO LOAD IMAGES AND DATA IN FLASH
I am looking for some help on AS3 and parsing. Here is my senerio: I had built a "static" flash template with dynamic data/image container Tied to an XML document. Everything is working when I publish it. Here is the next step that I cant figure it out.
I am playing around with multiple computers attached to monitors. What I would like to do is download the flash, XML and various images to my network server (closed circuit) no internet access. and for each computer/monitor I would like play the flash on the multiple monitors showing different images & data on each monitor. My thoughts are to utilize XML to dynamically change the data to each computer/monitor that would be ideal instead of creating multiple flash documents and download them to each individual computer/monitor to play what I want.
I am having trouble figuring out how to code the xml and actionscript to read the computer name and show the flash. below is an example of what I would like to accomplish with xml, flash and the content.
Main Host computer
(houses flash, xml, data)
Multiple computers
computer 1---- plays one thing
computer 2---- plays another image & different data v1
computer 3---- plays another image & different data v2
computer 4---- plays another image & different data v3
computer 5---- plays another image & different data v4
***actionscript****
//Create the XML Object
myXML = new XML()
myXML.ignoreWhite = true
//Load XML file
myXML.load("wsaw.xml")
//Make a reference to current timeline
myXML.ref = this
// Parse XML and fetch
myXML.onLoad = function(succes){
if(succes){
var root = this.firstChild
nodes = root.childNodes
for(var i=0; i<nodes.length; i++) {
this.ref["Amount_txt"+i].text = nodes.attributes.name
subnodes = nodes.childNodes
this.ref["Drawing_txt"+i].text = subnodes[0].firstChild.toString()
this.ref["holder_mc"+i].loadMovie(subnodes[1].firstChild.toString())
}
} else trace("Error loading XML document")
}
stop()
*******XML******
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE data[
<!ELEMENT title (Drawing, image)>
<!ATTLIST title name CDATA #REQUIRED>
<!ELEMENT Drawing (#PCDATA)>
<!ELEMENT image (#PCDATA)>
]>
<data>
<Amount name="$350,000">
<Drawing>Sunday, May 8, 2011 Drawing</Drawing>
<image>sample_image.png</image>
</title>
</data>
***What I need help is coding the Actionscript.
what I want it to do is: when it loads on the computer have flash "locate the computer name"
(Example 1: if this is computer 1, load image_6.png and data6,)
(Example 2: if this is computer 2, load image_4.png and data4,)
(Example 3: if this is computer 3, load image_2.png and data2,)
It should load the correct image & data to the specified computer monitor 1, 2, 3).
Can flash do that? Parsing, passing & loading to individual computer monitors using a "if" statement within flash.
I know its alot but I would apprciate all the help I can get.
Thank you
