6 Replies Latest reply on May 15, 2009 11:27 AM by rckehoe

    httpservice object e4x and using a mx:repeater

    rckehoe Level 1

      I have a PHP file that outputs an XML document like this:

       

      <root>

       

           <object>

                <name>Robert</name>

                <description>This is a sample description</description>

           </object>

       

           <object>

                <name>James</name>

                <description>This is a sample reply back to Roberts description</description>

           </object>

       

      </root>

       

       

       

      I am requesting this XML from an HTTPService like this:

       

      <mx:HTTPService id="MyHTTPService" resultFormat="e4x" url="http://www.MyDomain.com/get_chatter.php" result="LoadChatter(event);">
              <mx:request xmlns="">
                  <pass_code>XXXX</pass_code>
                  <chat_id>{ChatId}</chat_id>
              </mx:request>
          </mx:HTTPService>

       

       

       

      Then the result, LoadChatter is this:

      (I have the ChatXML as a Bindable private XML variable)

       

      private function LoadChatter(event:ResultEvent):void {
           ChatXML = event.result as XML;
      }

       

       

       

      Then I am trying to use a repeater like this:

       

      <mx:Canvas x="10" y="10" width="280" height="250" backgroundColor="#FFFFFF" backgroundAlpha="0.3" borderStyle="solid" borderThickness="1" borderColor="#FFFFFF">
             
              <mx:Repeater id="chatlines" dataProvider="{ChatXML.root.object}">
                  <mx:Label x="10" y="10" text="{chatlines.currentItem.name}:" color="#FFFFFF" fontWeight="bold" fontSize="10"/>
                  <mx:Text x="10" y="26" text="{chatlines.currentItem.description}" fontSize="8" color="#FFFFFF"/>
              </mx:Repeater>
             
          </mx:Canvas>

       

       

      It doesn't work... It never calls my XML document, what the heck am I doing wrong?

      I have been working on this script off and on for over a week and cannot figure it out!

       

      Any help would be very appreciated!