[FLASH 8] Galerie photo : probleme avec l'actionscript
Bonjour a tous,
Je me permets de vous contacter car je suis actuellement en train de travailler sur une galerie photo pour le site de mon asso mais je rencontre un probleme au niveau de l'actionscript... :
Voilà, j'ai recupéré sur Flashkit cette galerie (que j'ai deja un peu modifié...).
Pour ce que je veux faire cette galerie est parfaite... sauf que j'aimerai rajouter la possiblité que quand une des photos est affichée en grand, on puisse cliquer dessus pour la fermer (ou plutot devrais je dire, qu'elle retourne à sa position d'origine).
Etant graphiste à la base, le code est loin d'être mon fort ; et tous les essais que j'ai fait ont lamentablement echoué :P
Bref je rame ! :cry:
Si quelqu'un pouvait m'aider ou m'orienter vers une autre source ça serait vraiment sympath :D
Je vous laisse le fichier source ainsi que le code qui me pose probleme (toutes les actions étant regroupées sur un seul et même bouton) :
Code sur la 1ere image de la timeline :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| // this is a bounce factor, from 0 to a number < 1
// I suggest values from 0.4 to 0.6
bounce = 0.6;
// animation speed, from 0.001 (soooooo slow) to a number < 1
// affects bouncing. I suggst 0.5
speed = 0.5;
// offset, represent the frame of "Picture layered" object
// that you want as 1st photo (the one in the top-left corner)
frame_offset = 1;
// thumbnails size
thumb_x = 50;
thumb_y = 50;
// big potos size
big_x = 300;
big_y = 300;
// offset where to move big photos starting from thumbnails
// Play with it until you find the position you want
offset_x = 150;
offset_y = 150;
// minimum alpha; this is the alpha when the image are thumbnails.
// from 0 (invisible thumbnains) to 100 (100% solid thumbnails)
alphamin = 100;
stop() |
Code sur le bouton :
Code:
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
|
onClipEvent (load) {
this.pics.gotoAndStop(_root.frame_offset++);
bounce = _root.bounce;
speed = _root.speed;
final_width = _root.thumb_x;
final_height = _root.thumb_y;
final_x = this._x;
final_y = this._y;
startx = this._x;
starty = this._y;
}
onClipEvent (enterFrame) {
width = width*bounce+(final_width-this._width)*speed;
this._width += width;
if (Math.abs(final_width-this._width)<1) {
this._width = final_width;
}
height = height*bounce+(final_height-this._height)*speed;
this._height += height;
if (Math.abs(final_height-this._height)<1) {
this._height = final_height;
}
x = x*bounce+(final_x-this._x)*speed;
this._x += x;
if (Math.abs(final_x-this._x)<1) {
this._x = final_x;
}
y = y*bounce+(final_y-this._y)*speed;
this._y += y;
if (Math.abs(final_y-this._y)<1) {
this._y = final_y;
}
this._alpha = _root.alphamin+(100-_root.alphamin)*(this._x-_root.thumb_x)/(_root.big_x-_root.thumb_x);
}
onClipEvent (mouseDown) {
if (this.hitTest(_root._xmouse, _root._ymouse)) {
_parent._parent.swapDepths(10000);
_parent.swapDepths(10001);
this.swapDepths(10002);
_parent._parent[_root.url].image.final_width = _root.thumb_x;
_parent._parent[_root.url].image.final_height = _root.thumb_y;
_parent._parent[_root.url].image.final_x = _parent._parent[_root.url].image.startx;
_parent._parent[_root.url].image.final_y = _parent._parent[_root.url].image.starty;
_root.url = _parent._name;
final_width = _root.big_x;
final_height = _root.big_y;
final_x = _root.offset_x-_parent._x;
final_y = _root.offset_y-_parent._y;
}
} |
D'avance je vous remercie :D