2 Replies Latest reply on Sep 11, 2006 11:47 AM by yoyesman

    Creating tree from HTTPService

      Hi, I'm new under flex builder and I have a simple (?) problem :

      I would like to generate a tree from a XML file generate by PHP. I can display items (source) in tree but not subitems (playlist)...

      Here my XML file generated by PHP :

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <sourcelist>
      <source id="3" nom="WarholinDaMix">
      <playlist id="0" nom="Tous les fichiers"></playlist>
      </source>
      <source id="2" nom="YoyesGirl">
      <playlist id="0" nom="Tous les fichiers"></playlist>
      <playlist id="2" nom="Yo la liste Girly"></playlist>
      </source>
      <source id="1" nom="Yoyesman">
      <playlist id="0" nom="Tous les fichiers"></playlist>
      <playlist id="1" nom="Yo ma liste 1"></playlist>
      <playlist id="3" nom="Yo ma liste 2"></playlist>
      </source>
      </sourcelist>

      Here the code I use :

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="GetSource.send(null);">
      <mx:HTTPService id="GetSource" url=" http://127.0.0.1/SchmittTunes/bin/music.php?gettype=source" useProxy="false"/>
      <mx:Panel layout="absolute" left="10" right="10">
      <mx:Tree labelField="nom" dataProvider="{GetSource.lastResult.sourcelist.source}" width="100%" x="0" height="100%" y="0" showRoot="false"></mx:Tree>
      </mx:Panel>
      </mx:Application>

      How I said, I have 3 items displaying the 'source' on my tree, but I can't expand them. There is no arrow on the left side. So subitems like 'playlist' are not display.

      Does anyone know why or have an idea ?
      Thanks for your help

      Mika
        • 1. Re: Creating tree from HTTPService
          peterent Level 2
          On your HTTPService tag, add resultFormat="e4x" and see if that helps.
          • 2. Re: Creating tree from HTTPService
            Level 1
            Thanks ! it's working with resultFormat="e4x" tag in my HTTPService, but with some adaptations :

            I change the following :
            <mx:Tree labelField="nom" dataProvider="{GetSource.lastResult.sourcelist.source}" width="100%" x="0" height="100%" y="0" showRoot="false"></mx:Tree>

            By :
            <mx:Tree labelField="@nom" dataProvider="{GetSource.lastResult}" width="100%" x="0" height="100%" y="0" showRoot="false"></mx:Tree>

            Changes are about labelfield and dataprovider.
            Thanks for your help !