大众世界 world of demotic + 社区新动力

 找回密码
 注册会员
搜索
查看: 5257|回复: 0

[Flash] flash AS3 窗口大小改变触发Event.RESIZE事件(转载)

[复制链接]
发表于 2013-9-9 18:12:30 | 显示全部楼层 |阅读模式
[Actionscript3] 纯文本查看 复制代码
//http://www.cnblogs.com/602147629/archive/2010/12/27/1918221.html
stage.width,stage.height;//标识当前舞台上所有元素组合后的宽和高
stage.stageWidth,stage.stageHeight;//表示当前窗口的宽和高
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
mc.x = 0;
mc.y = 0;
stage.addEventListener(Event.RESIZE, resizeHandler);
function resizeHandler(evt:Event)
{
mc.width = stage.stageWidth;
mc.height = stage.stageHeight;
trace(mc.width);
}
stage.dispatchEvent(new Event(Event.RESIZE)); 


[Actionscript3] 纯文本查看 复制代码
//lybide
stop();
stage.align=StageAlign.TOP_LEFT;//=StageAlign.TOP_LEFT;
//stage.scaleMode="noScale";
stage.scaleMode=StageScaleMode.NO_SCALE;

var sie=0;
function wResize(e:Event) {
	var stageW=stage.stageWidth;
	var stageH=stage.stageHeight;
	bg1.x = (0);bg1.y = (0);
	bg1.x=stageW/2-bg1.width/2;
	bg1.y=stageH/2-bg1.height/2;
	bb1.x=stageW-bb1.width;
	//位置计算
	trace(stageW,stageH,bb1.width,stageW-bb1.width,sie)
	//testObj1._y = (Stage.height-testObj1._height)/2;
	sie++;
};
stage.addEventListener(Event.RESIZE,wResize);
stage.dispatchEvent(new Event(Event.RESIZE)); 
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Archiver|手机版|小黑屋|Wod Inc. ( 蜀ICP备20000008号-8

GMT+8, 2024-5-19 05:58 , Processed in 0.091806 second(s), 30 queries .

Powered by Discuz! X3.5

Copyright © 2001-2023 Tencent Cloud.

快速回复 返回顶部 返回列表