actionscript-3flashmovieclip

MovieClips scale down when StageScaleMode.NO_BORDER


I have my stage aligned to TOP_LEFT and scaled to StageScaleMode.NO_BORDER, the width and height of my SWF are : width = 1920 and height = 1080.

The thing is when my i change the SWF size to bigger (height/width) the movieClips on the stage scale up and that's a good thing for me, but when i reduce the size of my SWF to smaller values (smaller than the default size), the movieClips get reduced as well, aren't they supposed to stay the same, if not is there a way to make that happen ?


Solution

  • In fact the NO_BORDER scaleMode makes sure to not show the borders of the SWF and scale the center depending on the :

    The ratios :

    widthRatio = currentStageWidth/stageWidth
    

    and

    heightRatio = currentStageHeight/stageHeight.
    

    The stageWidth and stageHeight are provided by AS3.

    The currentStageWidth and currentStageHeight are supposed to be changing while resizing the browser window, the can be retrieved from the Flash Object (ie: $("#flashObjectId").width()).

    Then we should compare the two ratios (widthRatio and heightRatio), the bigger one has the scale value for the stage and the other elements on the stage.