1 Reply Latest reply on Dec 12, 2008 8:09 AM by Newsgroup_User

    How to resize an SWF

    Curious Khan
      Hi, all.

      Does any one know how to resize a SWF?

      The scenario goes like this:

      I have an SWF that has multiple Canvases.
      The SWF's wmode is set to 'window.'

      At start up, all the Canvases but one are invisible.
      On the visible Canvas, a user selects a menu.
      And the Canvas associated with the menu comes up and all other Canvases disappears.
      And I'd like to have the SWF resized to the dimension of the now visible Canvas.

      In the beginning, I wrote a JavaScript function as below:

      function setSize(id, w, h) {
      var obj = document.getElementById(id);
      obj.style.width = obj.width = w + "px";
      obj.style.height = obj.height = h + "px";
      }

      And called it in the SWF via the ExternalInterface.

      This approach worked in IE7, but not in Firefox 3.*.

      I somehow fumbled into finding that without the <object> tag it worked in FF.
      That is, if the SWF is created only with <embed> tag, it worked in FF.

      But I'm not sure till now that this is the way to do it.
      And I hope that someone can tell me if it is and, if not,
      what is the right way to do it.

      Thanks in advance.
        • 1. Re: How to resize an SWF
          Level 7

          "Curious Khan" <webforumsuser@macromedia.com> wrote in message
          news:ghtb96$1um$1@forums.macromedia.com...
          > Hi, all.
          >
          > Does any one know how to resize a SWF?
          >
          > The scenario goes like this:
          >
          > I have an SWF that has multiple Canvases.
          > The SWF's wmode is set to 'window.'
          >
          > At start up, all the Canvases but one are invisible.
          > On the visible Canvas, a user selects a menu.
          > And the Canvas associated with the menu comes up and all other Canvases
          > disappears.
          > And I'd like to have the SWF resized to the dimension of the now visible
          > Canvas.
          >
          > In the beginning, I wrote a JavaScript function as below:
          >
          > function setSize(id, w, h) {
          > var obj = document.getElementById(id);
          > obj.style.width = obj.width = w + "px";
          > obj.style.height = obj.height = h + "px";
          > }
          >
          > And called it in the SWF via the ExternalInterface.
          >
          > This approach worked in IE7, but not in Firefox 3.*.
          >
          > I somehow fumbled into finding that without the <object> tag it worked in
          > FF.
          > That is, if the SWF is created only with <embed> tag, it worked in FF.
          >
          > But I'm not sure till now that this is the way to do it.
          > And I hope that someone can tell me if it is and, if not,
          > what is the right way to do it.

          IE ignores the Embed tag and uses the Object tag, which embeds (pardon the
          confusing terminology--not sure what to call it) an ActiveX control. FF
          cannot embed ActiveX controls, so it ignores the Object tag and embeds the
          plugin form.

          HTH;

          Amy