6 Replies Latest reply on Jun 1, 2011 1:36 PM by Maxime Chupin

    SWFLoader and variable loading

    Maxime Chupin



      I am descovering Flex and I don't find how to load SWF which depends on the user choice. Let us see my little code to understand what I mean:


      <?xml version="1.0" encoding="utf-8" ?>
      <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                  public var selectedListItem:Object;


              <fx:Model id="anim">
                      <state label="Pendules" data="pendules"/>
                      <state label="Anguinéa" data="ang-visio"/>


          <s:Panel title="Halo List Control Example"
                  width="300"  x="500" y="50">
              <s:VGroup left="10" right="10" top="10" bottom="10">
                  <s:Label text="Selectionner une animation"/>
              <s:Label text="Actuellement '{selectedListItem.data}'.swf"/>
                  <mx:List id="source" width="100%" color="blue"
                          change="selectedListItem = List(event.currentTarget).selectedItem"/>
        <s:Panel x="30" y="50">
          <mx:SWFLoader autoLoad="true" source="@Embed('{selectedListItem.data}.swf')"/>


      Moreover, I think it is weird to embed a "variable" swf, but I do not manage to load a SWF without @Embed. Why?


      Thanks for help !