Control scaling of objects during fullscreen as3
I have flash ui built over the chromeless youtube player right now and I'm wondering if there is anyway to set certain sprites within the stage to not scale on fullscre开发者_运维知识库en without having to do inverted scaling. Thanks in advance!
Edit: I use FlashDevelop as my IDE and building this purely in as3
Generally when you scale any DisplayObject
, all of its children will scale with it. However it is possible to prevent the stage
from scaling on a resize. Try this:
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
EDIT: To get the kind of behavior you're looking for, you would have to manually perform some of the reszing. You will need to include the two lines of code above as it is the only way to prevent all of the content from scaling. Now add a resize handler so that you can scale only the DisplayObject
instances that you wish to resize, while keeping everything else the same:
stage.addEventListener(Event.RESIZE, stageResize);
function stageResize(event:Event):void {
myBackground.width = stage.stageWidth;
myBackground.height = stage.stageHeight;
// ...
}
精彩评论