2 Replies Latest reply on Aug 26, 2009 6:53 AM by praj58

    how to send data one row at a time from xml to flex

    praj58

      I want to setTimerEvent while sending data from xml to flex, one row at a time.

      I have attached the xml.

       

      Thanks in advance.

        • 1. Re: how to send data one row at a time from xml to flex
          Gregory Lafrance Level 6

          Do you mean you want to make a separate database call for each line of data?

           

          If not, because you are using a timer, you could have a static variable lineNum:uint and then for the Timer.TIMER event use this as the index into an XMLListCollection to get the next item of data from the XML data.

           

          If this post answers your question or helps, please mark it as such.

          • 2. Re: how to send data one row at a time from xml to flex
            praj58 Level 1

            Hi Greg,

            Thanks for the reply. You must have seen the xml which i have attached.Here is the .mxml code which i have written:

             

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="accountData.send()">

             

            <mx:Script>
            <![CDATA[
            import mx.controls.*;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;
            import mx.collections.ArrayCollection;

             

             
            [Bindable]
            private var AccountInformation:ArrayCollection;

             

            private function AccountHandler(evt:ResultEvent):void
            {
                AccountInformation = evt.result.xml.AccInfo;
            }

             

             

             

            private function faultHandler(evt:FaultEvent):void
            {
                var faultMessage:String = "Could not connect with XML file";
                Alert.show(faultMessage, "Error opening file");
            }
            ]]>
            </mx:Script>

             

            <mx:HTTPService id="accountData" url="pgm1.xml" result="AccountHandler(event)" fault="faultHandler(event)"  />
            <mx:DataGrid x="20" y="24" width="950" dataProvider="{AccountInformation}" />
            </mx:Application>

             

             

            This reads and displays all the rows. But I want to display single row at a time with sometime time gap between the display of two consecutive rows.I am new to flex and this is my first code, so need your help on this.

             

            I hope i have made myself clear. If there is anything else please let me know.

            Looking forward to some solution.

             

            Thanks in advance.

             

            Regards,

            praj58