Thanks - new issue. Getting error "1131: Classes must not be nested" The var
testInfo loads fine. But when I try to filter down - using "private var
jane:XMLList = testData.(country == "India");" - I get nothing. I've played
around with argument order but with no success.
Any ideas?
// Structure of XML file APAC.xml //
<data>
<Location>
<regrank>6</regrank>
<country>China</country>
<region>Asia</region>
<reg08>184</reg08>
<reg09>584</reg09>
<regp>2.8</regp>
<regn>200</regn>
<ex08>767</ex08>
<ex09>100</ex09>
<exp>3.9</exp>
<exn>263</exn>
</Location>
</data>
// My MXML File //
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
creationComplete="testData.send()">
<mx:HTTPService url="assets/APAC.xml" id="testData" result="xmlHandler(event)"
resultFormat="e4x"/>
<mx:Script>
<![CDATA[
[Bindable] public var testInfo:XMLList;
private var jane:XMLList = testData.(country == "India");
--- In [email protected], "Tracy Spratt" <tr...@...> wrote:
>
> Use an e4x expression. They all return XMLList, so watch for that if you
> need to assign a result to an XML var. If you are sure there is only one
> node in the result, do var xmlResult:XML = xmllistResult[0];
>
>
>
> See the documentation for e4x syntax and usage, post back here if you have a
> specific question or problem.
>
>
>
> Tracy Spratt,
>
> Lariat Services, development services available
>
> _____
>
> From: [email protected] [mailto:[email protected]] On
> Behalf Of AJC2357
> Sent: Thursday, September 17, 2009 11:28 AM
> To: [email protected]
> Subject: [flexcoders] Declaring New Variable from XML Source
>
>
>
>
>
> Hello,
>
> I have a large XML file that I use with Flex to graphically display specific
> data. For example, it is easy to create a graph that shows GDP by country.
> (which creates a graph for all countries in XML file)
>
> But how can narrow or filter these searches?
>
> I want to have the graph show only the countries that are in region x for
> instance. Can anyone show me how to create a new variable that is derived
> from a subset of the XML file?
>
> I am new to actionscript but the logic would seem to be: create new variable
> from XML source based on a given criteria (i.e., region == "Asia")
>
> Any help?
>