• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Resize flash stage to match contained external swf

Community Beginner ,
Apr 24, 2017 Apr 24, 2017

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?

Views

352

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 24, 2017 Apr 24, 2017

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

Votes

Translate

Translate
Community Expert ,
Apr 24, 2017 Apr 24, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 24, 2017 Apr 24, 2017

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:

  1. Check the size of the loaded content (the external swf loaded into the player swf)
  2. Make an external JS call to resize my flash object
  3. Move my player controls based on the size of the loaded content

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 24, 2017 Apr 24, 2017

Copy link to clipboard

Copied

LATEST

Pretty much, yeah.

  • load content and make size determination
  • send this data to parent JS function in DOM to resize the container swf
  • adjust anything internal to container swf as needed

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines