3 Replies Latest reply on Jun 18, 2011 11:51 AM by Maxime Chupin

    Statique load of XML file with List choose

    Maxime Chupin Level 1



      So let me explain my problem:

      - I have some XML files: (in my <fx:Declaration>)
          <fx:XML id="flexang" source="xml/flex-ang.xml" />
          <fx:XML id="flexastro" source="xml/flex-astro.xml" />
          <fx:XML id="flexber" source="xml/flex-ber.xml" />

      - I have a List constructed as follows:

      (in my  <fx:Declaration>)

          <fx:Model id="anim">
          <state label="Anguinéa" data="animations/flex-ang.swf"/>
          <state label="Mouvement rétrograde" data="animations/flex-astro.swf"/>
          <state label="Bielle de Bérard" data="animations/flex-ber.swf"/>

      (and then)

            <mx:List id="source" width="100%" color="blue"
                 change="selectedListItem = List(event.currentTarget).selectedItem;"/>

      (with public var selectedListItem:Object;)

      My List is built to load dynamicaly some SWF files

            <mx:SWFLoader id="animation"


      - But now I want to display the corresponding. So I tried to contruct the String of the XML id from the selectedListItem.data:


      private function xmlFile(swf:String):String
                  var pref:String;
              var tab=swf.split(".",2);
              return pref;


      This gives me, for example, "flexang" from "animations/flex-ang.swf". But my problem is that I want to put my XML file in my RichText area:

              <s:RichEditableText id="codeView" editable="false" textFlow="{TextFlowUtil.importFromXML(xmlFile(selectedListItem.data))}" />


      But xmlFile returns a String! and I do not know how to specify that it is a XML id.


      I hope I am clear enough.


      Thanks if you try to help me