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 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
dia = 1;
a_btn.onPress = function() {
dialoding();
};
b_btn.onPress = function() {
dia--;
mcLoader.unloadClip(this["Diapositive"+dia+".jpg"]);
};
//
function dialoding() {
posi2_mc = lodeurAV(dia, 150, 150, 20, 20);//ici j'ai simplifié logiquequement je charge 3images avec des profondeurs et tailles différentes
dia++;
}
var loadListener:Object = new Object();
function lodeurAV(num, xx, yy, echelX, echelY) {
loadListener.onLoadError = function(target_mc:MovieClip, errorCode:String, httpStatus:Number) {
createEmptyMovieClip("myClip_mc", this.getNextHighestDepth());
trace("erreur");
myClip_mc = createRectangle(200, 20, 250, 200, 0x6666FF);
};
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(loadListener);
var zone_mc:MovieClip = this.createEmptyMovieClip("zone_mc"+num, num);
this["zone_mc"+num]._x = xx;
this["zone_mc"+num]._y = yy;
this["zone_mc"+num]._xscale = echelX;
this["zone_mc"+num]._yscale = echelY;
//trace(xx+" "+yy+" "+echelX+" "+echelY+" "+zone_mc.getDepth());
mcLoader.loadClip("Diapositive"+num+".jpg", this["zone_mc"+num]);
return mcLoader;
}
//this.createEmptyMovieClip("zone_mc", 0);
function createRectangle(posiX:Number, posiY:Number, Width:Number, Height:Number, color:Number):MovieClip {
var depth:Number = (this.getNextHighestDepth()-1);
var rect:MovieClip = this.createEmptyMovieClip("rect_"+depth, depth);
rect.beginFill(0xAA00FF, 30);
rect.lineStyle(5, 0x0000FF, 100);
rect.moveTo(posiX, posiY);
rect.lineTo(posiX, (posiY+Height));
rect.lineTo((posiX+Width), (posiY+Height));
rect.lineTo((posiX+Width), posiY);
rect.lineTo(posiX, posiY);
rect.endFill();
rect.beginFill(0xAA00FF, 30);
return rect;
} |
Partager