Results 1 to 3 of 3
Thread: Convert chlid nodes to var
-
October 31st, 2010, 03:29 PM #14Registered User
postsConvert chlid nodes to var
Hi, I tried the last 3 hours to convert child nodes to variables.
I followed the tutorial on http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm
I use the following (working) code:My output is:Code:var xmlLoader:URLLoader = new URLLoader(); var xmlData:XML = new XML(); xmlLoader.addEventListener(Event.COMPLETE, LoadXML); xmlLoader.load(new URLRequest("language.xml")); function LoadXML(e:Event):void { xmlData = new XML(e.target.data); ParseLanguages(xmlData); } function ParseLanguages(LanguagesInput:XML):void { trace("XML Output"); trace("------------------------"); var languageList:XMLList = LanguagesInput.Language.(Country == "CtryNo=752&LangNo=46"); trace(languageList); }Now I try to assign variables to each child (Country, Search, Link, etc). But I don't seem to succeed with that.Code:<Language lang="Sweden"> <Country>CtryNo=752&LangNo=46</Country> <Search>Sök</Search> <Link>Länk till produktsida</Link> <CompBat>Kompatibelt med följande batterier</CompBat> <CompDev>Kompatibelt med följande apparater</CompDev> </Language>
I tried different approaches like:
- var test = languageList.Country
- var test = e.item.Country
-
November 1st, 2010, 05:08 AM #2185Registered User
postsHere is a pretty thorough tutorial for you..
http://www.republicofcode.com/tutorials/flash/as3xml/
-
November 6th, 2010, 04:35 AM #34Registered User
postsThanks!!! That was exactly what I needed :-)

Reply With Quote

Bookmarks