non chiedermi come faccia a funzionare perchè é un mistero
Codice PHP:
var cont = _root.createEmptyMovieClip("cont", 1);
var vuot = cont.createEmptyMovieClip("vuot", 1);
var targ = cont.createEmptyMovieClip("targ", 2);
targ.attachMovie("pallino", "pallino", 1);
cont._x = Stage.width/2;
cont._y = Stage.height/2;
var cObj = new Object();
var tWee = new Tween();
cObj.onLoadInit = function(target) {
target._width = 100;
target._height = 70;
target._x = -target._width/2;
target._y = -target._height/2;
tW = cont._width;
tH = cont._height;
};
var mcLoader = new MovieClipLoader();
mcLoader.addListener(cObj);
mcLoader.loadClip("foto.jpg", vuot);
var obj = new Object();
obj.onMouseDown = function() {
if (vuot.hitTest(_root._xmouse, _root._ymouse)) {
targ._x = cont._xmouse;
targ._y = cont._ymouse;
tW = Math.floor(tW*2);
tH = Math.floor(tH*2);
x = Math.floor((vuot._x*2)-targ._x);
y = Math.floor((vuot._y*2)-targ._y);
vuot._width = tW;
vuot._height = tH;
vuot._x = x;
vuot._y = y;
}
};
Mouse.addListener(obj);
c'è la parte di creazione dei clip che compongono l'oggetto dello zoom
c'è l'attachMovie di un clip in libreria, una piccola pallina che mi serve per determinare la posizione da calcolare nello zoom (puoi farla da 1x1 px e renderla trasparente)
c'è la parte del caricamento dell'immagine dall'esterno
infine c'è la parte dei calcoli di spostamento
ah fa uno zoom ad ogni click, puoi limitarlo a 1 solo rimuovendo il listener dalla classe Mouse