Saturday, November 21, 2009

Control Adjust Flash Player Window Size

When you create Shockwave File (SWF) in Adobe Flash (say in version CS4) and play it in Flash Player in non-bowser mode, the Player Window Size gets automatically adjusted to the values specified by the Stage Width and Height parameters in your flash file.

Take a look at the following two SWFs created in Flash CS4. They are the same Tinting Flash files - only difference being the Stage Width value. The first one has width value 250 while the second one 435, height being 292 for both.

The first one simply Crops the image but there is no scroll bar.





However, things are little different when you create SWF using Flex. If you create say the Line Chart in Flex Builder 3 and play it in Flash Player, it does not fit automatically in the Window and you get a Scroll Bar. The user needs to drag the Player Window or make it full screen to have a full view.



To Control and Adjust Flash Player Window Size so that it fits nice and fine with your application, all you need to do is to define Width and Height values of your application at the very beginning of your MXML code.

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top" horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" width="650" height="265">


1 comment:

  1. Hi, I have I slightly different problem. If I open my swf file the player opens a window that is smaller than the width and height I've set in my MXML. I did not get scroll bars and have to manually resize the window to get right size. This is annoying but is not a real problem, the big problem is that if i set the Show All option (instead of 100%) in the player menu to have the application automatically resize to follow the player window, the only thing that is resized is the part of application that was visible when I've opened the player.
    I hope I have made it clear enought to be understandable ! I really need to use the Show All option. Have you any idea on how to solve it ?
    Thank You very much
    Luca

    ReplyDelete