3 Replies Latest reply on Jul 29, 2010 12:57 AM by Balakrishnan V

    Data to XML

    GeorgeWS Level 1

      I have a sample I am using that uses an xml file to populate the controls. like:

      service = new PhotoService("data/galleries.xml")

       

      This works but I want to gather the data from a server database instead. What should I do?

      Get data with remoteobject and convert that to an xml file? Sample?

       

      Thanks George

        • 1. Re: Data to XML
          rtalton Level 4

          You could use a HTTPService to load the xml file.


          • 2. Re: Data to XML
            Joshfromdallas

            you can use several methods and services, Basically you just need your SQL to output a xml file. There are some great tutes at the Learn Flash in a week page:

             

            http://www.adobe.com/devnet/flex/videotraining/

             

            Enjoy!

            • 3. Re: Data to XML
              Balakrishnan V Level 3

              Importing an xml is very easy using the DCD-wizard in Flash Builder 4.

               

              You can alternatively have the following mxml/As code.

               

               

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

              <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"

                 xmlns:s="library://ns.adobe.com/flex/spark"

                 xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="SendHTTPService()">

              <fx:Script>

              <![CDATA[

              protected var data:Object;

              import mx.rpc.events.ResultEvent;

              protected function SendHTTPService():void

              {

              myHttpService.send()

              }

              protected function myHttpService_resultHandler(event:ResultEvent):void

              {

              data=event.result

              }

               

              ]]>

              </fx:Script>

              <fx:Declarations>

              <!-- Place non-visual elements (e.g., services, value objects) here -->

              <s:HTTPService id="myHttpService"

                 url="myUrl"

                 result="myHttpService_resultHandler(event)"/>

              </fx:Declarations>

              </s:Application>

               

               

              You may box your data:Object into any other datatype as well as per the requirement

               

               

              Hope  this helps,

               

              balakrishnan v