There are a number of ways to do this.  I would start by looking at the xml
help files in the flash help.  If you get looking at the object and it's
methods you will get an idea of how it works.

There are also some good tutorials out there:
http://www.actionscript.org/resources/articles/56/1/Loading-External-XML-fo
rmatted-Content-into-Flash-MX-2004/Page1.html


Here is the code to get the name California to trace in flash:

external_xml.onLoad = function(success:Boolean) {
        if (success) {
                trace("xml loaded successfully.");
                //Do something with the XML in here.
                trace("NAME :
"+this.firstChild.firstChild.attributes.name);
        }  else {
        trace("xml failed to load.");
        } 
};

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Scott
Haneda
Sent: Thursday, November 09, 2006 2:59 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] Noob, basic questions on actionscript,
withmethodology suggestions

> Hi,
> 
>     You will need to move external_xml.load call below the onLoad
> function because your file will probably be loaded before the handler is
> defined (locally).
> 
>     with trace(myXML) you have defined "myXML" inside the function -
> this means it is not in scope outside the function.  Try:
> 
>   var external_xml:XML = new XML();
> 
>    //trace if loaded, or not
>   external_xml.onLoad = function(success:Boolean) {
>     if (success) {
> trace("xml loaded successfully.");
> //Do something with the XML in here.
>     }  else {
>       trace("xml failed to load.");
>     } 
>  };
> 
> //variable loads external XML file afterwards
> external_xml.load("example1.xml");
> 
> trace(external_xml);

Thanks, and if my XML looks like this:
Load in this XML file:
<camps sport="Tennis">
    <state name="California" cc="3" url="a"/>
    <state name="Oregon" cc="13" url="b"/>
    <state name="Washington" cc="2" url="c"/>
</camps>

What would be the best way to get myself a set of accessible variables in
which I can call out a state name, and get  the two remaining parameters?
-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
<http://www.newgeo.com>                     Novato, CA U.S.A.


_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to