|
-
infinite sliding image gallery with pop up images
So, I am new to flash (or better yet, actionscript)
and I am trying to create a picture gallery (15-20 pictures total) that slides right and left on mouse movement, and loops around the pictures (when picture 20 comes on the screen then picture one is shown - there are many examples of this on the forum) and I also want to be able to click the thumbnail that is sliding, and onClick, have a larger version of the same image pop up. when the large image is clicked it disappears and the thumbnails keep on running on stage.
So, thanks to this forum, this is what I have in my flash file:
Code:
import mx.transitions.Tween;
import mx.transitions.easing.*;
kNbrPictures = 9;
kPictureWidth = 180
kPictureHeight = 180
var kPictureY=(Stage.height-kPictureHeight)/2
pix = [];
for (a=1;a<=kNbrPictures;a++){
var Clip=_root.attachMovie("thum"+a, "thum"+a+"_mc", a );
Clip._y=kPictureY
myThum_mc = Clip["thum"+a+"_mc"];
myThum_mc.largerImage = a;
myThum_mc.onRollOver=function(){
this._alpha=100
}
myThum_mc.onRollOut=function(){
this._alpha=100
}
myThum_mc.onRelease = function(){
for (a=1; a<= kNbrPictures; a++) {
var myClip = Clip["thumb"+a+"_mc"];
myClip.enabled = false;
}
}
_root.attachMovie("image"+this.largerImage,"large_mc",2);
large_mc._x = (Stage.width - large_mc._width)/2;
large_mc._y = (Stage.height - large_mc._height)/2;
large_mc.onRelease = function() {
var myFadeOut = new Tween (large_mc,"_alpha",Strong.easeOut, 100,0,0.5,true);
myFadeOut.onMotionFinished=function(){
for (a=1; a<=kNbrPictures; a++) {
var myClip =Clip["thumb"+a+"_mc"];
myClip.enabled = true;
}
large_mc.removeMovieClip();
};
}
pix.push(Clip)
}
kCellWidth = kPictureWidth;
kStretchFactor = 1.1;
kStretchSensitivity = 0.5;
kMouseSensitivity = .0002;
CX = Stage.width/2;
pixPos = 0;
ppToX = function(pixPos, i)
{
if (i < pixPos-kNbrPictures/2)
{
i += kNbrPictures;
}
else if (i > pixPos+kNbrPictures/2)
{
i -= kNbrPictures;
}
var di = i - pixPos;
return (CX-kCellWidth/2)+di*kCellWidth;
}
_root.onEnterFrame = function(){
pixPos += (_xmouse - CX)*kMouseSensitivity;
if (pixPos < 0)
pixPos += kNbrPictures;
else if (pixPos > kNbrPictures)
pixPos -= kNbrPictures;
for (var i = 0; i < kNbrPictures; ++i) {
pix[i]._x = ppToX(pixPos, i);
}
}
This works perfect except for the pop up image.
Any suggestion? I-ve never done actionscript before...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|