1 Reply Latest reply on May 26, 2008 11:15 AM by MasterOfAir

    loading a different swf when clicking on button?

    MasterOfAir
      Hello, hello!
      I am using this excellent free SDK for Adobe air!
      I am now trying to create a first application to see if I can use Adobe AIR for my Msc project application!
      (to introduce this wonderful technology to the university!!!)

      I am trying something simple, I want to achieve this: by clicking into a button, it will change the swf currently displayed...
      for example by clicking on button1 it will change the source of the swfloader, to display another.

      What I am thinking
      - maybe could simply have different "swf loaders" and play with "visible" / "invisible" but that might makes a bad application in terms of ressources, cpu, etc...

      What I tried:
      <mx:Button label="change" fontSize="18" click="flashbox.source=&quot;C:\Documents and Settings\me\Desktop\FlashMSC\Application\interface.swf&quot;"/>
      <mx:SWFLoader id="flashbox" source="C:\Documents and Settings\me\Desktop\FlashMSC\Application\interface2.swf" />

      Edit:nevermind the "equote" in this code... the proper code something like:
      <mx:Button label="change" fontSize="18" click="flashbox.source='C:\Documents and Settings\me\Desktop\FlashMSC\Application\interface.swf'"/>
      <mx:SWFLoader id="flashbox" source="C:\Documents and Settings\me\Desktop\FlashMSC\Application\interface2.swf" />
      It did not make any error message when rendering! Although I am unsure about doublequote/single quote...



      Of course the whole application has more code but that is the main two lines!!!
      And...it does not works!! it does remove the main image but show a broken link for the second one!!


      Thaaaanks!
        • 1. loading a different swf when clicking on button?
          MasterOfAir Level 1
          Wouhou!! I found out on my own how to do!
          Here is the answer, which I believe will be important for windows programmers!!

          you have to "double backslashes" if you want to show the proper path under windows!
          for example "c:\coco" is wrong, it needs to be "c:\\coco"!!


          So my proper code is:
          <mx:Button label="change" fontSize="18" click="flashbox.source='C:\\Documents and Settings\\me\\Desktop\\FlashMSC\\Application\\interface.swf'"/>

          and that works!!!