Your switch statement doesn't work because it should look like this
instead:

<PAGE pg_name='index'>
  <DETAILS>This is some more of the home page.</DETAILS> 
</PAGE>

            switch (xmldata.pa...@pg_name)
            {
                case "index":
                    pageDetails = xmlData.DETAILS.toString();
                    break;
                case "contact":
                    pageDetails = xmlData.DETAILS.toString();
                    break;
            }

That said, the line: "pageDetails = xmlData.DETAILS.toString();" is
repeated over and over in your switch, which is pointless.

Instead of a switch statement, use E4X syntax in XML to get the right
data - something like this:

pageDetails = xmlData.PAGE.(@pg_name == "someValue").DETAILS.text();


Jason Merrill 

Bank of  America  Global Learning 
Learning & Performance Solutions

Join the Bank of America Flash Platform Community  and visit our
Instructional Technology Design Blog
(note: these are for Bank of America employees only)





-----Original Message-----
From: flashcoders-boun...@chattyfig.figleaf.com
[mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John
Singleton
Sent: Wednesday, May 05, 2010 8:49 AM
To: flashcoders@chattyfig.figleaf.com
Subject: [Flashcoders] XML Question

Hi;
I have this in an external xml file:

<PAGE pg_name='index'>
  <DETAILS>This is some more of the home page.</DETAILS> </PAGE>

My objective is to use a switch statement like this:

            switch (xmlda...@page_name.tostring())
            {
                case "index":
                    pageDetails = xmlData.DETAILS.toString();
                case "contact":
                    pageDetails = xmlData.DETAILS.toString();
            }

and pass a var to the swf so I can change the content (DETAILS) of the
page based on the same. I know I'm going about this the wrong way, but I
don't know how to do it correctly. Also, my switch statement doesn't
work anyway. Please advise.
TIA,
John


      
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to