Flex 3 - How to read data dynamically from XML

Posted by Brian Roisentul on Stack Overflow See other posts from Stack Overflow or by Brian Roisentul
Published on 2009-10-05T14:52:21Z Indexed on 2010/04/15 2:03 UTC
Read the original article Hit count: 543

Filed under:
|
|

Hi Everyone,

I'm new at Flex and I wanted to know how to read an xml file to pull its data into a chart, using Flex Builder 3.

Even though I've read and done some tutorials, I haven't seen any of them loading the data dynamically. For example, I'd like to have an xml like the following:

<data>
    <result month="April-09">
        <visitor>
            <value>8</value>
            <fullname>Brian Roisentul</fullname>
            <coid>C01111</coid>
        </visitor>
        <visitor>
    		<value>15</value>
    		<fullname>Visitor 2</fullname>
    		<coid>C02222</coid>
        </visitor>
        <visitor>
    		<value>20</value>
    		<fullname>Visitor 3</fullname>
    		<coid>C03333</coid>
    	</visitor>
    </result>
    <result month="July-09">
        <visitor>
            <value>15</value>
            <fullname>Brian Roisentul</fullname>
            <coid>C01111</coid>
        </visitor>
        <visitor>
    		<value>6</value>
    		<fullname>Visitor 2</fullname>
    		<coid>C02222</coid>
        </visitor>
        <visitor>
    		<value>12</value>
    		<fullname>Visitor 3</fullname>
    		<coid>C03333</coid>
    	</visitor>
    </result>
    <result month="October-09">
        <visitor>
            <value>10</value>
            <fullname>Brian Roisentul</fullname>
            <coid>C01111</coid>
        </visitor>
        <visitor>
    		<value>14</value>
    		<fullname>Visitor 2</fullname>
    		<coid>C02222</coid>
        </visitor>
        <visitor>
    		<value>6</value>
    		<fullname>Visitor 3</fullname>
    		<coid>C03333</coid>
    	</visitor>
    </result>   
</data>

and then loop through every "visitor" xml item and draw their values, and display their "fullname" when the mouse is over their line.

If you need some extra info, please let me just know.

Thanks,

Brian

© Stack Overflow or respective owner

Related posts about flex3

Related posts about Xml