If I understood you correctly, you want to filter the XML data according to a variable passed to the SWF. If so you'd do something like:

var pageDetails:String = xmlData.PAGE.(@pg_name == loaderInfo.parameters.page).DETAILS;
// "page" is the name of the var passed to the SWF here

But I strongly recommend you to have a look at SWFAddress, which is absolutely indispensable framework if you are creating a site driven by dynamic data ;)

Kenneth Kawamoto
http://www.materiaprima.co.uk/

John Singleton wrote:
----- Original Message ----

From: "[email protected]" <[email protected]>
To: Flash Coders List <[email protected]>
Sent: Wed, May 5, 2010 12:48:28 PM
Subject: Re: [Flashcoders] XML Question

Say for example you are in the home section and obtaining the data for
it,
you'd do:

var pageData:XML = xmlData.PAGE.(@pg_name == "index")[0];

Then build the page based on pageData XML.

k. Now, how can I build a switch statement to determine which page? I plan to pass a var to my swf, 
then call the data based on the value of the var (in this case, "index"). As stated 
previously, my switch statement, for reasons I don't understand, is giving me the value 
"indexcontent"; that is, all the values of pg_name:

        function completeXMLListener(e:Event):void
        {
            var xmlData:XML = XML (e.target.data);
            trace(xmldata.pa...@pg_name.tostring())
            switch (xmldata.pa...@pg_name.tostring())
            {
                case "index":
                    pageDetails = xmlData.PAGE.DETAILS.toString();
                    break;
                case "contact":
                    pageDetails = xmlData.PAGE.DETAILS.toString();
                    break;
                default:
                    pageDetails = xmlData.PAGE.DETAILS.toString();
                    trace(pageDetails);
                    break;
            }
            MyTextBlock();
        }

TIA,
John
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to