1 Reply Latest reply on Jun 29, 2010 8:13 AM by JuneXiong

    Cann't load xml file in Adobe AIR Application


      Hi, I have a problem in loading xml file into my air application.

      I am using the following code to load xml file:

      <fx:XML id="mydata" source="../xml/events.xml" />


      The format of xml file is:

      <?xml version="1.0" encoding="UTF-8"?>


      <event date="2010-4-12 21:1:47.761" type="KB" tl="BASE" data="www." />

      <event date="2010-4-12 21:1:48.627" type="KB" tl="BASE" data="google." />

      <event date="2010-4-12 21:1:49.296" type="KB" tl="BASE" data="com" />

      <event date="2010-4-12 21:1:53.934" type="KB" tl="BASE" data="www." />

      <event date="2010-4-12 21:1:56.32" type="KB" tl="BASE" data="cnn." />

      <event date="2010-4-12 21:1:56.782" type="KB" tl="BASE" data="com" />

      <event date="2010-4-12 21:2:1.474" type="KB" tl="BASE" data="www." />

      <event date="2010-4-12 21:2:4.746" type="KB" tl="BASE" data="digg." />

      <event date="2010-4-12 21:2:5.913" type="KB" tl="BASE" data="cpm" />



      and using following code to use data into chart item.

      dataProvider={mydata.children}, xField = {date}, yField={type}


      As I use customized itemRenderer, I try to show "data" into items in the chart, so I rewrite the function like that:

      override public function set data(value:Object):void{

           super.data = value;

           if(value == null)


           trace("data=", value.attibute("*").toXMLString());

           //set the label's value

           dateDisplay.text = value["@date"] ;

           if(value["@type"] == 'KB'){

                dataDisplay.text = value["@data"];


                type.text = "Key Press";


                if(value["@type"] == 'MC'){


                     dataDisplay.text = value["@domain"];

                     type.text = "Mouse Click";


                     dataDisplay.text = value["@domain"];





      There is no error in compiling, but when I run it as a windows desktop application, nothing is generated but with an increasing size in memory. I have to kill the program when the memory is up to 1,034,568K. Is it usual thing when running AIR application? I am using flex4 in eclipse


      Could you help me to check out the way I use to load xml file? Does anyone know better way to use xml file as a dataProvider in chart?

      Thanks so much.