天天看点

Flash满屏-自适应-对齐

★满屏★

HTML设置:

<style type="text/css">

html,body,#FlashID{

margin:0px;

padding:0px;

height:100%;

width:100%;

overflow:hidden;

}

</style>

Flash设置:

如果Flash内容占满舞台,需要首先执行一次大小对应;比如:

bj.width=stage.stageWidth;

bj.height=stage.stageHeight;

这样,就保证了HTML调用时,不管Flash本身大于还是小于显示器分辨率,都能让Flash满屏显示在游览器上

★自适应和对齐★

普通应用:

import flash.display.StageAlign;

import flash.display.StageScaleMode;

stage.align="TL";

stage.scaleMode="noScale";

stage.addEventListener(Event.RESIZE,resizeHandler);

function resizeHandler(event:Event) {

    bj.width=stage.stageWidth;

    bj.height=stage.stageHeight;

    mc.x=stage.stageWidth/2;

    mc.y=stage.stageHeight/2;

}

GS应用:

import flash.display.StageAlign;

import flash.display.StageScaleMode;

import com.greensock.layout.*;

stage.align="TL";

stage.scaleMode="noScale";

var area:AutoFitArea=new AutoFitArea(this,0,0,stage.stageWidth,stage.stageHeight,0xff0000);

area.attach(pp1,ScaleMode.PROPORTIONAL_OUTSIDE, AlignMode.CENTER, AlignMode.CENTER);

area.preview=true;

var ls:LiquidStage=new LiquidStage(stage,800,555,800,555);

ls.attach(pp2, ls.RIGHT_CENTER);

ls.attach(pp3, ls.LEFT_CENTER);

转载于:https://blog.51cto.com/1213785174/1435736