3 Replies Latest reply on Apr 24, 2017 10:24 AM by JosephLabrecque

    Resize flash stage to match contained external swf

    JEJoll Level 1

      I've created a media player in flash which loads both flvs and swfs at runtime. It was originally designed to run at a fixed size, but I have a new requirement to have the player resize to fit the content.

       

      Imagine the player is 1366x768 (for example), and the loaded media is 500x500. Currently the player will retain its size of 1366x768, and the loaded media will also stay at 500x500.

       

      Now suppose that, instead, I want the player (and the window containing it) to fit itself to the size of the contents, so that in the above example, both the player and the content will be 500x500.

       

      Essentially, what I would like to do is say something like

       

      stage.width = myLoadedContent.width;
      stage.height = myLoadedContent.height;
      //Some math to reposition all of my UI elements, etc.
      

       

      Based on my search results, and my own experimentation, stage height and width cannot be set at run time (and even setting the size of the document through 'Modify>Document...' does not change the size of the stage, as tracing the stage size gives numbers different than what I've set the document dimensions to).

       

      Is there some way this can be done?