实现FLASH随浏览器宽度变化而居中显示的效果
这个FLASH的设置的画布宽度应该是1280PX;
但是用1024的显示器也只显示1024,还没有把页面撑开!(其实这个就和网页的背景,是一个道理,先检查浏览器的宽度,然后背景就显示多大)
代码:
Stage.align = "TL";
Stage.scaleMode = "noScale";
MovieClip.prototype.easeTo = function(x, y, speed) {
this.onEnterFrame = function() {
if (Math.round(this._x) == Math.round(x) && Math.round(this._y) == Math.round(y)) {
delete this.onEnterFrame;
} else {
this._x = this._x-(this._x-x)/speed;
this._y = this._y-(this._y-y)/speed;
}
};
};
_global.setStagePosition = function() {
stageHeight = Stage.height;
if (stageHeight>=750) {
mainY = 80;
footerY = 580;
} else if (stageHeight<=620) {
mainY = 0;
footerY = 468;
} else {
mainY = stageHeight-630;
footerY = stageHeight-180;
}
tester = mainY;
_root.main.easeTo(0, mainY, 5);
_root.footer.easeTo(0, footerY, 5);
};
OBresize = new Object();
OBresize.onResize = function() {
setStagePosition();
};
Stage.addListener(OBresize);
侦听舞台的当前大小,给MC定位,在html中设置为100%
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |