ActionScript 3 全屏中心

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 全屏中心相关的知识,希望对你有一定的参考价值。

import flash.events.*;

stop();

stage.addEventListener(Event.ENTER_FRAME, setStage);
stage.addEventListener(Event.RESIZE, setStage);

function setStage(event:Event):void
{
	mainMovie.x = (stage.stageWidth / 2) - (mainMovie.width / 2);
	mainMovie.y = (stage.stageHeight / 2) - (mainMovie.height / 2);
	
	mainBg.x = (stage.stageWidth / 2) - (1920 / 2);
	mainBg.y = (stage.stageHeight / 2) - (1200 / 2);
}


// mainMovie (Movie Clip) is the whole movie which gets centered
// mainBg (Movie Clip) is the background which gets also centered

以上是关于ActionScript 3 全屏中心的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 全屏as3

ActionScript 3 在全屏退出事件

ActionScript 3 全屏图像调整大小(按比例)

Actionscript 3全屏切换

ActionScript 3 数字工具 - 中心,boundery

ActionScript 3 与中心对齐