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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
|
var numImage:Number = 1;
var maxImage:Number = 26;
var X_PETITE_VIGNETTE:Number = 120/1280;
var Y_PETITE_VIGNETTE:Number = 90/960;
var X_GRANDE_VIGNETTE:Number = 267/1280;
var Y_GRANDE_VIGNETTE:Number = 200/960;
var X_FULL_SIZE:Number = 500/960;
var Y_FULL_SIZE:Number = 500/960;
import flash.display.*;
import flash.net.URLRequest;
import flash.events.Event;
if(maxImage > 0) {
photo_centre.load(new URLRequest("img/r1.jpg"));
photo_centre.addEventListener(Event.COMPLETE, show_grande_vignette);
photo_gauche.load(new URLRequest("img/r"+maxImage+".jpg"));
photo_gauche.addEventListener(Event.COMPLETE, show_petite_vignette_gauche);
}
if(2 <= maxImage) {
photo_droite.load(new URLRequest("img/r2.jpg"));
photo_droite.addEventListener(Event.COMPLETE, show_petite_vignette_droite);
}
function show_grande_vignette(event:Event):void {
var img:DisplayObject = photo_centre.content as DisplayObject;
img.scaleX = X_GRANDE_VIGNETTE;
img.scaleY = Y_GRANDE_VIGNETTE;
photo_centre.source = img;
}
function show_petite_vignette_gauche(event:Event):void {
var img:DisplayObject = photo_gauche.content as DisplayObject;
img.scaleX = X_PETITE_VIGNETTE;
img.scaleY = Y_PETITE_VIGNETTE;
photo_gauche.source = img;
}
function show_petite_vignette_droite(event:Event):void {
var img:DisplayObject = photo_droite.content as DisplayObject;
img.scaleX = X_PETITE_VIGNETTE;
img.scaleY = Y_PETITE_VIGNETTE;
photo_droite.source = img;
}
//Définition des actions sur le formulaire
btn_suivant.addEventListener(MouseEvent.MOUSE_DOWN, suivant);
btn_precedent.addEventListener(MouseEvent.MOUSE_DOWN, precedent);
photo_centre.addEventListener(MouseEvent.MOUSE_DOWN, zoomIn);
function suivant(event:MouseEvent):void {
zoomOut(event);
photo_gauche.addEventListener(Event.COMPLETE, show_petite_vignette_gauche);
photo_centre.addEventListener(Event.COMPLETE, show_grande_vignette);
photo_droite.addEventListener(Event.COMPLETE, show_petite_vignette_droite);
photo_gauche.load(new URLRequest("img/r"+numImage+".jpg"));
numImage++;
if(numImage > maxImage) numImage = 1;
photo_centre.load(new URLRequest("img/r"+numImage+".jpg"));
if((numImage + 1) > maxImage) numImage = 1;
photo_droite.load(new URLRequest("img/r"+(numImage + 1)+".jpg"));
function sgv(event:Event):void {
var img:DisplayObject = photo_centre.content as DisplayObject;
img.scaleX = X_GRANDE_VIGNETTE;
img.scaleY = Y_GRANDE_VIGNETTE;
photo_centre.source = img;
}
function spvg(event:Event):void {
var img:DisplayObject = photo_gauche.content as DisplayObject;
img.scaleX = X_PETITE_VIGNETTE;
img.scaleY = Y_PETITE_VIGNETTE;
photo_gauche.source = img;
}
function spvd(event:Event):void {
var img:DisplayObject = photo_droite.content as DisplayObject;
img.scaleX = X_PETITE_VIGNETTE;
img.scaleY = Y_PETITE_VIGNETTE;
photo_droite.source = img;
}
}
function precedent(event:MouseEvent):void {
zoomOut(event);
photo_gauche.addEventListener(Event.COMPLETE, show_petite_vignette_gauche);
photo_centre.addEventListener(Event.COMPLETE, show_grande_vignette);
photo_droite.addEventListener(Event.COMPLETE, show_petite_vignette_droite);
photo_droite.load(new URLRequest("img/r"+numImage+".jpg"));
numImage--;
if(numImage < 1) numImage = maxImage;
photo_centre.load(new URLRequest("img/r"+numImage+".jpg"));
if(numImage < 2) photo_gauche.load(new URLRequest("img/r"+maxImage+".jpg"));
else photo_gauche.load(new URLRequest("img/r"+(numImage - 1)+".jpg"));
function sgv(event:Event):void {
var img:DisplayObject = photo_centre.content as DisplayObject;
img.scaleX = X_GRANDE_VIGNETTE;
img.scaleY = Y_GRANDE_VIGNETTE;
photo_centre.source = img;
}
function spvg(event:Event):void {
var img:DisplayObject = photo_gauche.content as DisplayObject;
img.scaleX = X_PETITE_VIGNETTE;
img.scaleY = Y_PETITE_VIGNETTE;
photo_gauche.source = img;
}
function spvd(event:Event):void {
var img:DisplayObject = photo_droite.content as DisplayObject;
img.scaleX = X_PETITE_VIGNETTE;
img.scaleY = Y_PETITE_VIGNETTE;
photo_droite.source = img;
}
}
function zoomIn(event:MouseEvent):void {
var img:DisplayObject = photo_centre.content;
img.scaleX = X_FULL_SIZE;
img.scaleY = Y_FULL_SIZE;
photo_centre.move(-463,-365);
photo_centre.width = 667;
photo_centre.height = 500;
//photo_centre.update();
photo_centre.removeEventListener(MouseEvent.MOUSE_DOWN, zoomIn);
photo_centre.addEventListener(MouseEvent.MOUSE_DOWN, zoomOut);
}
function zoomOut(event:MouseEvent):void {
var img:DisplayObject = photo_centre.content;
img.scaleX = X_GRANDE_VIGNETTE;
img.scaleY = Y_GRANDE_VIGNETTE;
photo_centre.width = 267;
photo_centre.height = 200;
photo_centre.move(-133.5, -102);
photo_centre.removeEventListener(MouseEvent.MOUSE_DOWN, zoomOut);
photo_centre.addEventListener(MouseEvent.MOUSE_DOWN, zoomIn);
//suivant();
} |
Partager