Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PARSING XML TO LOAD IMAGES AND DATA IN FLASH

New Here ,
May 20, 2011 May 20, 2011

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

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 21, 2011 May 21, 2011
LATEST

1. If you are talking about Flash player plugin (browser based) - there is no way to read client computer information in the manner you hope. Perhaps you should look into AIR application development.

2. The code you shown is AS2 but this is an AS3 forum. You should post questions related to AS2 on the corresponding forum.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines