Hello! First post here.
Ok so I’m making a gallery at
http://rosscostanza.com/
I have a problem with the template I’m using.
CLick on Portrait and as you can see the girl’s picture is cut off and does not show all of the photo.
I need a way to have a scrolling effect when you mous over towards the bottom of the the image, so you can view the entire thing!
here is my code. Can someone re write the code so the image (loaded by the xml) can scroll or something… Without having to make each image a seperate swf.
//////////////////////////////////////////////////////////////////////////////
//IMAGE THUMSNAIL AND KEY CONTROLLER SETTING//////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function loadXML(loaded)
{
if (loaded)
{
xmlNode = this.firstChild;
image = [];
thumbnails = [];
heading = [];
description = [];
url = [];
total = xmlNode.childNodes.length;
for (i = 0; i < total; i++)
{
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
thumbnails* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
thumbnails_fn(i);
heading* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue;
url* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue;
} // end of for
firstImage();
}
else
{
content = "eror loaded...";
} // end else if
} // End of the function
//////////////////////////////////////////////////////////////////////////////
function nextImage()
{
if (p < total - 1)
{
++p;
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie(image[p], 1);
title_txt.text = heading[p];
desc_txt.text = description[p];
picture_num();
} // end if
}
else if (p == total - 1)
{
p = 0;
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie(image[p], 1);
title_txt.text = heading[p];
desc_txt.text = description[p];
picture_num();
} // end if
} // end else if
} // End of the function
//////////////////////////////////////////////////////////////////////////////
function prevImage()
{
if (p > 0)
{
--p;
picture._alpha = 0;
picture.loadMovie(image[p], 1);
title_txt.text = heading[p];
desc_txt.text = description[p];
picture_num();
}
else if (p == 0)
{
p = total - 1;
if (loaded == filesize)
{
picture._alpha = 0;
picture.loadMovie(image[p], 1);
title_txt.text = heading[p];
desc_txt.text = description[p];
picture_num();
} // end if
} // end else if
} // End of the function
//////////////////////////////////////////////////////////////////////////////
function firstImage()
{
if (loaded == filesize)
{
picture._x = (350-picture._width)/2;
picture._y = (0-picture._height)/2;
picture._alpha = 0;
picture.loadMovie(image[0], 1);
title_txt.text = heading[p];
desc_txt.text = description[0];
picture_num();
} // end if
} // End of the function
//////////////////////////////////////////////////////////////////////////////
function picture_num()
{
current_pos = p + 1;
pos_txt.text = current_pos + " / " + total;
} // End of the function
//////////////////////////////////////////////////////////////////////////////
//THUMBSNAIL RGHT LEFT CONTROLLER////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function thumbNailScroller()
{
_root.imagesMC.imagestab.createEmptyMovieClip("tscroller", 1000);
_root.imagesMC.imagestab.tscroller.onEnterFrame = function ()
{
if (_root.imagesMC.imagestab._ymouse >= _root.imagesMC.imagestab.thumbnail._y && _root.imagesMC.imagestab._ymouse <= _root.imagesMC.imagestab.thumbnail._y + _root.imagesMC.imagestab.thumbnail._height)
{
if (_root.imagesMC.imagestab._xmouse >= _root.imagesMC.imagestab.hit_right._x - 95 && _root.imagesMC.imagestab.thumbnail.hitTest(_root.imagesMC.imagestab.hit_right))
{
_root.imagesMC.imagestab.thumbnail._x = _root.imagesMC.imagestab.thumbnail._x - thspeed;
}
else if (_root.imagesMC.imagestab._xmouse <= 75 && _root.imagesMC.imagestab.thumbnail.hitTest(_root.imagesMC.imagestab.hit_left))
{
_root.imagesMC.imagestab.thumbnail._x = _root.imagesMC.imagestab.thumbnail._x + thspeed;
} // end else if
}
else
{
delete _root.imagesMC.imagestab.tscroller.onEnterFrame;
} // end else if
};
} // End of the function
//////////////////////////////////////////////////////////////////////////////
//THUMNAILS SELECT CONTROLLER////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
function thumbnails_fn(k)
{
_root.imagesMC.imagestab.thumbnail.createEmptyMovieClip("t" + k, _root.imagesMC.imagestab.thumbnail.getNextHighestDepth());
_root.imagesMC.imagestab.tlistener = new Object();
_root.imagesMC.imagestab.tlistener.onLoadInit = function (target_mc)
{
target_mc._x = _root.imagesMC.imagestab.hit_left._x + (target_mc._width - 1) * k;
target_mc.pictureValue = k;
target_mc.onRelease = function ()
{
p = this.pictureValue - 1;
nextImage();
};
target_mc.onRollOver = function ()
{
target_mc._alpha = 50;//thumbsnail alpha rollover
thumbNailScroller();
};
target_mc.onRollOut = function ()
{
target_mc._alpha = 100;//thumbsnail alpha rollout
};
};
image_mcl = new MovieClipLoader();
image_mcl.addListener(_root.imagesMC.imagestab.tlistener);
image_mcl.loadClip(thumbnails[k], "_root.imagesMC.imagestab.thumbnail.t" + k);
} // End of the function
//////////////////////////////////////////////////////////////////////////////
//LOAD XML SETTING///////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("content/portrait.xml");
//////////////////////////////////////////////////////////////////////////////
previous.onRelease = function ()
{
prevImage();
};
//////////////////////////////////////////////////////////////////////////////
next.onRelease = function ()
{
nextImage();
};
//////////////////////////////////////////////////////////////////////////////
///thumbs image view rol over out ////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
tabspeed = 5;
imagestab.onLoad = function ()
{
imagestab.destinY = 415;
};
imagestab.onEnterFrame = function ()
{
imagestab.y = imagestab.destinY - imagestab._y;
imagestab._y = imagestab._y + imagestab.y / tabspeed;
if (_root._ymouse >= 411)
{
imagestab.destinY = 415;
} // end if
if (_root._ymouse <= 320)
{
imagestab.destinY = 415;
} // end if
};
//////////////////////////////////////////////////////////////////////////////
imagestab.tabbtn.onRollOver = function ()
{
imagestab.destinY = 355;
};
scrolling = function () {
var scrollHeight:Number = scrollbg._height;
var contentHeight:Number = contentMain._height;
var draggerHeight:Number = dragger._height;
var maskHeight:Number = maskedView._height;
//
var initPosition:Number = dragger._y=scrollbg._y; var initContentPos:Number = contentMain._y;
var finalContentPos:Number = maskHeight-contentHeight+initContentPos;
//
var left:Number = scrollbg._x;
var top:Number = scrollbg._y;
var right:Number = scrollbg._x;
var bottom:Number = scrollbg._height-draggerHeight+scrollbg._y;
//
var dy:Number = 0;
var speed:Number = 10;
var moveVal:Number = (contentHeight-maskHeight)/(scrollHeight-draggerHeight);
//
dragger.onPress = function() {
var currPos:Number = this._y;
startDrag(this, false, left, top, right, bottom);
this.onMouseMove = function() {
dy = Math.abs(initPosition-this._y);
contentMain._y = Math.round(dy*-1*moveVal+initContentPos);
};
};
dragger.onMouseUp = function() {
stopDrag();
delete this.onMouseMove;
};
btnUp.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y + speed < maskedView._y) {
trace(dragger._y + " " + top);
if (dragger._y <= top) {
dragger._y = top;
contentMain._y += speed;
} else {
contentMain._y += speed;
dragger._y -= speed / moveVal;
}
} else {
dragger._y = top;
contentMain._y = maskedView._y;
delete this.onEnterFrame;
}
};
};
btnUp.onDragOut = function() {
delete this.onEnterFrame;
};
btnUp.onMouseOut = function() {
delete this.onEnterFrame;
};
btnDown.onPress = function() {
this.onEnterFrame = function() {
if (contentMain._y - speed >finalContentPos) {
if (dragger._y>=bottom) {
contentMain._y -= speed;
dragger._y = bottom;
} else {
contentMain._y -= speed;
dragger._y += speed/moveVal;
}
} else {
dragger._y = bottom;
contentMain._y = finalContentPos;
delete this.onEnterFrame;
}
};
};
btnDown.onRelease = function() {
delete this.onEnterFrame;
};
btnDown.onDragOut = function() {
delete this.onEnterFrame;
};
};
scrolling();
//////////////////////////////////////////////////////////////////////////////
//Link blank self controller/////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
urLLink.onRelease = function ()
{
getURL(url[p], "_blank");
};
p = 0;
_root.onEnterFrame = function ()
{
filesize = picture.getBytesTotal();
loaded = picture.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize)
{
preloader.preload_bar._xscale = 100 * loaded / filesize;
}
else
{
preloader._visible = false;
if (picture._alpha < 100)
{
picture._alpha = picture._alpha + 10;
} // end if
} // end else if
if (url[p] != null && url[p] != " " && url[p] != undefined)
{
urLLink._visible = true;
}
else
{
urLLink._visible = false;
} // end else if
};
thspeed = 7;
//////////////////////////////////////////////////////////////////////////////
//end/////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////