Salutation littelflea
--
Pour faire suite à ta demande
--
/* Image clé 1 */
--
function Carte () {
Carte.prototype._xo=this._x;
Carte.prototype._yo=this._y;
}
Carte.prototype = new MovieClip();
Carte.prototype.zoom=function(cible,pas) {
if (cible._xscale+pas<10) {
cible._xscale=cible._yscale=10;
clearInterval(cible.zoomID);
}
else if (cible._xscale+pas>300) {
cible._xscale=cible._yscale=300;
clearInterval(cible.zoomID);
}
else {
cible._xscale+=pas;
cible._yscale+=pas;
}
}
Carte.prototype.zoomIn=function() {
this.zoomID=setInterval(this.zoom, 50,this,10);
}
Carte.prototype.zoomOut=function() {
this.zoomID=setInterval(this.zoom,50,this,-10);
}
Carte.prototype.zoomStop=function() {
clearInterval(this.zoomID);
}
Carte.prototype.referenciel=function(refere) {
this.xinf=refere._x-(refere._width/2);
this.xsup=refere._x+(refere._width/2);
this.yinf=refere._y-(refere._height/2);
this.ysup=refere._y+(refere._height/2);
}
Carte.prototype.drag=function(cible) {
var mode=(cible._xscale>=100) ? 1 : 0 ;
var deltaX=_root._xmouse+cible.pointDragX;
var deltaY=_root._ymouse+cible.pointDragY;
switch (mode) {
case 0 :
cible._x=((deltaX-(cible._width/2))<cible.xinf) ? cible.xinf+(cible._width/2) : ((deltaX+(cible._width/2))>cible.xsup) ? cible.xsup-(cible._width/2) : deltaX;
cible._y=((deltaY-(cible._height/2))<cible.yinf) ? cible.yinf+(cible._height/2) : ((deltaY+(cible._height/2))>cible.ysup) ? cible.ysup-(cible._height/2) : deltaY;
break;
case 1 :
cible._x=((deltaX-(cible._width/2))>cible.xinf) ? cible.xinf+(cible._width/2) : ((deltaX+(cible._width/2))<cible.xsup) ? cible.xsup-(cible._width/2) : deltaX;
cible._y=((deltaY-(cible._height/2))>cible.yinf) ? cible.yinf+(cible._height/2) : ((deltaY+(cible._height/2))<cible.ysup) ? cible.ysup-(cible._height/2) : deltaY;
break;
default :
break;
}
}
Carte.prototype.onPress=function() {
this.pointDragX=this._x-_root._xmouse;
this.pointDragY=this._y-_root._ymouse;
this.dragID=setInterval(this.drag,50,this);
}
Carte.prototype.onRelease=Carte.prototype.onReleaseOutside=function() {
clearInterval(this.dragID);
}
Object.registerClass("MCcarte", Carte);
/* image clé 2 */
--
BTNplus.onPress=function() {
MCcarte.zoomIn();
}
BTNmoins.onPress=function() {
MCcarte.zoomOut();
}
BTNplus.onRelease=BTNplus.onReleaseOutside=BTNmoins.onRelease=BTNmoins.onReleaseOutside=function() {
MCcarte.zoomStop();
}
MCcarte.referenciel(MCcadre);
stop();
--
Ce script provient de :
La bible Micro Application flash MX version 6
Auteur : Marion Périchaud & Xavier Bielawski
Référence : 3803 sur le site de
[ Lien ] .
ISBN : 2-7429-2803-0
--
Bonne prog . . .
Improve