1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
MovieClip.prototype.init = function() {
this.orig_w=this._width;
this.orig_h=this._height;
};
MovieClip.prototype.chargeImage = function(fichier) {
this._alpha=100;
duplicateMovieClip(this,"toto",1);
toto.loadMovie(fichier);
this.onEnterFrame = function() {
if ((toto._width<>this.orig_w) or (toto._height<>this.orig_h)) {
toto._yscale = 100*Math.min(this.orig_w/toto._width, this.orig_h/toto._height);
toto._xscale = toto._yscale;
toto._X = this._X + (this._width - toto._width) / 2;
toto._Y = this._Y + (this._height - toto._height) / 2;
delete this.onEnterFrame;
}
else {
trace("taille non modifiée");
}
}
};
container.init();
container.chargeImage("test.jpg"); |
Partager