View Single Post
  #1 (permalink)  
Old Nov 28th, 2006, 19:41
itorch itorch is offline
Junior Member
Join Date: Nov 2006
Location: London,England
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Mouse scrollable gallery

I am trying to make a cursor scrollable gallery of say 5 or 6 photos. the only thing i have found so far is a horizontal and vertical scrollable photo. the photo is one big photo. i was thinking of making a large photo out of my 6 smaller photos but i only want the scroller to be horizontal. any ideas?[code][//variable for the image instance path (symbol: reef_graphic, instance: img)
varimg = _root.img
//variable for the background instance path (symbol: background, instance: bgd)
varbgd = _root.bgd
//speed of the mouse scroll (between 0 and 1)
v=0.2
//mouse position
mousex = varbgd._xmouse;
mousey = varbgd._ymouse;
//image position
imgx = getProperty(varimg, _x);
imgy = getProperty(varimg, _y);
//distance fom the center to the left, right, top and bottom side
left = getProperty(varimg,_width) / 2
right = (getProperty(varimg,_width) / (-2)) + (getProperty(varbgd,_width))
top = getProperty(varimg,_height) / 2
bottom = (getProperty(varimg,_height) / (-2)) + (getProperty(varbgd,_height))
//scrolling of the image
setProperty (varimg, _x, (imgx+(mousex*v)));
setProperty (varimg, _y, (imgy+(mousey*v)));
//stop the image on the horizontal side
//left
if (getProperty(varimg, _x) >= left) {
if (mousex > 0) {
mousex = 0
setProperty(varimg, _x, left); }
else if (mousex < 0) {
mousex = varbgd._xmouse ;
setProperty (varimg, _x, (imgx+(mousex*v))); }
}
//right
if (getProperty(varimg, _x) <= right) {
if (mousex < 0) {
mousex = 0
setProperty(varimg, _x, right); }
else if (mousex > 0) {
mousex = varbgd._xmouse ;
setProperty (varimg, _x, (imgx+(mousex*v))); }
}
//stop the image on the vertical side
//top
if (getProperty(varimg, _y) >= top) {
if (mousey > 0) {
mousey = 0 ;
setProperty(varimg, _y, top); }
else if (mousey < 0) {
mousey = varbgd._ymouse;
setProperty(varimg, _y, (imgy+(mousey*v)));}
}
//bottom
if (getProperty(varimg, _y) <= bottom) {
if (mousey < 0) {
mousey = 0 ;
setProperty (varimg, _y , bottom); }
else if (mousey >0) {
mousey = varbgd._ymouse;
setProperty(varimg, _y,(imgy+(mousey*v)));}
}

//can be deleted, usefull for adjust your image
set ("_level0" , imgx);
set ("_level0:mx" , mousex);
set("_level0:y", imgy);
set ("_level0:my", mousey);/CODE]
Reply With Quote