首先新建一个mc,mc中什么都不要。
在mc上写代码,如下(flash大小为800*600):
onClipEvent (load) {
if (this._width<>0 and this._height<>0) {
if (this._width>this._height) {
//图片是横向
this._height = this._height*800/this._width;
this._width = 800;
} else {
//图片是纵向
this._width = this._width*600/this._height;
this._height = 600
}
}
}
在mc上写代码,如下(flash大小为800*600):
onClipEvent (load) {
if (this._width<>0 and this._height<>0) {
if (this._width>this._height) {
//图片是横向
this._height = this._height*800/this._width;
this._width = 800;
} else {
//图片是纵向
this._width = this._width*600/this._height;
this._height = 600
}
}
}
浙公网安备 33010602011771号