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

Scaling SWF to less than or equal to original size

Community Beginner ,
Apr 01, 2010 Apr 01, 2010

Does anyone know how to scale a SWF in the browser window, but not larger than the original stage size in the FLA file?  For instance, I've designed a course in Flash with stage size of 1024x768 in Flash.  In the published HTML document, I change the following values:

'width', '1024' changed to 'width', '100%'

'height', '768' changed to 'height', '100%'

'scale', 'noscale' changed to 'scale', '100%'

These changes in the HTML source code allow the SWF to size with the browser, but I don't want the SWF to grow larger than 1024x768 if the browser window is greater than these dimensions.  I want the max size of the SWF to be 1024x768 regardless of the browser window.

Does anyone know how to achieve this in the HTML source code and/or AS2?

Thank you!

TOPICS
ActionScript
1.8K
Translate
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 01, 2010 Apr 01, 2010

use a stage onresize listener to control the size of your flash display

Translate
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 ,
May 03, 2010 May 03, 2010

In addition to my original post, I took the advice to use the onResize listener, but am running into several issues described below the following code:

Stage.align = "TL"; //doesn't work; why?
Stage.scaleMode = "noScale";
var stageListener:Object = new Object();
stageListener.onResize = function():Void
{
    if(Stage.width < 1024.0 || Stage.height < 768.0)
    {
        trace("The movie should be scaling");
        Stage.scaleMode = "scale";
    }
    else
    {
        trace("The movie should not be scaling");
        Stage.scaleMode = "noScale"; //doesn't work; why?
    }
}
Stage.addListener(stageListener);

The above code works partially, but then stops, i.e. when I press CTRL + ENT to test the SWF:

  1. The first line of code does not recognize that I want to top-center the SWF.
  2. If I resize the SWF I get the correct messages traced initially, but the SWF continues to scale if the stage is > 1024x768.
  3. What should my HTML publish settings in Flash be for this code to work properly?  Should this code override the HTML publish settings?  If so, it doesn't.  In other words, the SWF doesn't scale at all when launched in the published HTML file, but the stand-alone SWF file does scale.  I would have to modify the HTML source code for the SWF to scale, so it seems that there is a disconnect between the AS2 code and the published HTML file.

Thanks for any help you can offer.

Translate
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 ,
May 03, 2010 May 03, 2010
LATEST

click file/publish settings/html and select percent, 100 x 100.  retest.

Translate
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