2 Replies Latest reply on Dec 16, 2009 2:15 PM by maheekp

    components xml data


      Hi guys,


      I have an application as below. I have a component and main application.

      I am connecting to an xml file through the component and calling the component in main application.


      Let me know what is wrong in my code.


      component ---

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

         import mx.rpc.events.ResultEvent;
         import mx.collections.XMLListCollection;
         private var _headerData : XML = new XML();
         private function set headerData(evt:ResultEvent):void{
         _headerData = new XML(evt.result.testData);

           <mx:HTTPService id="testData" url="/xml/test.xml" />

        <mx:HBox width="100%">
        <mx:Spacer width="10" />
        <mx:Grid id="headerGrid" width="100%" height="77"
              borderStyle="solid" borderColor="#03131E" verticalGap="1" horizontalGap="25"
           <mx:Label text="Name: "/>
           <mx:Label text="{XML(_headerData.NAME)}" fontWeight="bold"/>
           <mx:Label text="Role: "/>
           <mx:Label text="{XML(_headerData.ROLE)}" fontWeight="bold"/>
           <mx:Label text="Type: "/>
           <mx:Label text="{XML(_headerData.TYPE)}" fontWeight="bold"/>




      main application ---
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      layout="absolute" xmlns:components="components.*"

      <mx:Panel id="onepanel"
           color="green" x="0" y="0"
      <components:HeaderSection width="100%"/>

      xml file --- name is test.xml--- placed under src/xml/test.xml

      <?xml version="1.0"?>


      <NAME>ABC Name</NAME>