Copy link to clipboard
Copied
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?
If you make a call out to a JS function on the parent DOM, you should be able to target and resize the Flash Player content whenever anything loads.
ExternalInterface - Adobe ActionScript® 3 (AS3 ) API Reference
Copy link to clipboard
Copied
If you make a call out to a JS function on the parent DOM, you should be able to target and resize the Flash Player content whenever anything loads.
ExternalInterface - Adobe ActionScript® 3 (AS3 ) API Reference
Copy link to clipboard
Copied
Thanks for the reply Joseph.
I'm not entirely sure I understand this approach.
Based on what you've said, do these steps seem to make sense to you:
Copy link to clipboard
Copied
Pretty much, yeah.