DAN ZEN EXPO - CODE EXHIBIT -
ZEN PICTURE
current = this;
mask = _parent.mask;
viewerText = _parent.pictureLabel;
// need a viewer loaded call back
callBack = _parent.callBack;
// and a method to set and get the list
rssCheck = false;
xSpeed = 0;
ySpeed = 0;
speed = 2
maxSpeed = 8
frameRate = 31;
noSpeedRange = 20 // percent of mask where movement is stopped
currentDirection = -1
lastDirection = 0;
lastSound = 0;
readyCheck = 0 // if we've set the next picture
currentPic = 0;
goCheck = 0; // starts animation
mouseMoveCheck = 0; // check variable to activate h and v speed change
mouseIntervalCheck = 0; // check variable to delay h and v speed changes
zoomCheck = 0;
panCheck = 0;
panCount = 0; // counts clicks on pan to avoid setting zoom first time
pastPanCheck = 0;
doubleCheck = 0;
soundCheck = 1;
soundToggle = 1;
singleCheck = 0;
firstZoomCheck = 0; // keeps track of first zoom - clears with double click
zoomBackDuration = 1; //seconds
zoomMax = 300; //not really max but gets apportioned to .5 maskwidth
fitCheck = 0;
fitTally = 0;
popPick = 0;
keyPause = 0; //spacer pressed to pause show
lastCursor = "";
mouseShowCheck = 0;
myXML = new XML();
myXML.ignoreWhite = true
myXML.onLoad = prepare;
uList = this._url.split("/")
if (_parent.xml != undefined && _parent.xml != null) {
if (_parent.xml.substr(_parent.xml.length-5,_parent.xml.length-1) != ".xml") {
xmlurl = _parent.xml + ".xml";
} else {
xmlurl = _parent.xml;
}
xmlurl = "../blossoms/zenpicture.xml";
} else {
xmlurl = uList[uList.length-1].split(".")[0] + ".xml";
}
myXML.load(xmlurl, newVars, POST);
bs = new Sound(_parent.sound1);
ms1 = new Sound(_parent.sound2);
ms2 = new Sound(_parent.sound3);
zL = mask._x;
zT = mask._y;
zR = zL + mask._width;
zB = zT + mask._height;
///////////////////// ZenPicture 2 code //////////////////
_parent.fit.onRelease = function(){
if (fitCheck == 1) {
unFit(current["p"+popPic]);
return;
}
if (zoomCheck > 0 && current["p"+popPic] == zoomPic) {
pw = zoomOriginalW;
ph = zoomOriginalH;
ps = zoomOriginalScale;
} else {
pw = current["p"+popPic]._width;
ph = current["p"+popPic]._height;
ps = current["p"+popPic]._xscale;
}
fitOldX = current["p"+popPic]._x;
fitOldY = current["p"+popPic]._y;
fitOldS = current["p"+popPic]._xscale;
if (pw > ph) {
newScale = current.mask._width / (pw / ps * 100) * 100;
if (rssCheck) {
current["p"+popPic]._x = mask._x;
current["p"+popPic]._y = mask._y+(mask._height - (ph / ps * 100) * newScale / 100)/2;
} else {
current["p"+popPic].slideTo(mask._x,mask._y+(mask._height - (ph / ps * 100) * newScale / 100)/2, zoomBackDuration, "easeInOutCubic");
}
} else {
newScale = current.mask._height / (ph / ps * 100) * 100;
if (rssCheck) {
current["p"+popPic]._x = mask._x +(mask._width - (pw / ps * 100) * newScale / 100)/2;
current["p"+popPic]._y = mask._y;
} else {
current["p"+popPic].slideTo(mask._x +(mask._width - (pw / ps * 100) * newScale / 100)/2, mask._y, zoomBackDuration, "easeInOutCubic");
}
}
if (popPic == 0) {
prePop = pictures.length - 1;
postPop = popPic+1;
} else if (popPic == pictures.length -1) {
postPop = 0;
prePop = popPic-1;
} else {
prePop = popPic-1;
postPop = popPic*1+1;
}
if (rssCheck) {
current["p"+prePop]._alpha = 0;
current["p"+postPop]._alpha = 0;
current["p"+popPic]._xscale = current["p"+popPic]._yscale = newScale;
alphaBack();
} else {
current["p"+prePop].alphaTo(0, zoomBackDuration, "easeInOutCubic",0,alphaBack);
current["p"+postPop].alphaTo(0, zoomBackDuration, "easeInOutCubic");
current["p"+popPic].scaleTo(newScale, zoomBackDuration, "easeInOutCubic");
}
fitCheck = 1;
}
function alphaBack() {
current["p"+prePop]._visible = false;
current["p"+postPop]._visible = false;
}
function fitBack() {
fitCheck = 0;
}
function unFit(p){
current["p"+prePop]._visible = true;
current["p"+postPop]._visible = true;
if (rssCheck) {
current["p"+prePop]._alpha = 100;
current["p"+postPop]._alpha = 100;
p._x = fitOldX;
p._y = fitOldY;
p._xscale = p._yscale = fitOldS;
fitBack();
} else {
current["p"+prePop].alphaTo(100, zoomBackDuration, "easeInOutCubic");
current["p"+postPop].alphaTo(100, zoomBackDuration, "easeInOutCubic");
p.slideTo(fitOldX, fitOldY, zoomBackDuration, "easeInOutCubic");
p.scaleTo(fitOldS, zoomBackDuration, "easeInOutCubic",0,fitBack);
}
}
function changeFit(p){
current["p"+prePop]._alpha = 100;
current["p"+postPop]._alpha = 100;
current["p"+prePop]._visible = true;
current["p"+postPop]._visible = true;
popPic = currentPic;
pw = p._width;
ph = p._height;
ps = p._xscale;
fitOldS = ps;
fitOldX = mask._x;
fitOldY = mask._y;
// set scale of new pic to mask w or h
if (pw > ph) {
newScale = current.mask._width / (pw / ps * 100) * 100;
p._x = mask._x;
p._y = mask._y+(mask._height - (ph / ps * 100) * newScale / 100)/2;
} else {
newScale = current.mask._height / (ph / ps * 100) * 100;
p._x = mask._x +(mask._width - (pw / ps * 100) * newScale / 100)/2;
p._y = mask._y;
}
p._xscale = p._yscale = newScale;
}
_parent.pop.onRelease = function(){
pw = current["p"+popPic]._width / current["p"+popPic]._xscale * 100;
ph = current["p"+popPic]._height / current["p"+popPic]._yscale * 100;
clickpic = pictures[popPic];
clickdes = description[popPic];
clickdes2 = clickdes.split("\"").join("\\\"");
if (rssCheck) {
clickurl = flickr[popPic];
trace (clickurl);
getURL("javascript:popup = window.open('','','width="+pw+",height="+ph+",scrollbars=0,resizable=0'); popup.document.open(); popup.document.write(\"<html><head><title>"+clickdes2+"</title></head><body bgcolor=#000000 style='padding:0; margin:0;'><a target='_flickr' href='"+clickurl+"'><img src='"+clickpic+"' width='"+pw+"' height='"+ph+"' border='0'></a></body></html>\"); popup.document.close(); popup.window.focus();");
} else {
getURL("javascript:popup = window.open('','','width="+pw+",height="+ph+",scrollbars=0,resizable=0'); popup.document.open(); popup.document.write(\"<html><head><title>"+clickdes2+"</title></head><body bgcolor=#000000 style='padding:0; margin:0;'><img src='"+clickpic+"' width='"+pw+"' height='"+ph+"'></body></html>\"); popup.document.close(); popup.window.focus();");
}
}
cursors = [cursorSlide,cursorZoom,cursorPan,cursorPan2,cursorWait];
for (i=0; i<cursors.length; i++) {
cursors[i].duplicateMovieClip("c_"+i, 990+i);
cursors[i].swapDepths(this["c_"+i]);
cursors[i]._visible = false;
}
function zoomMove() {
z = zoomPic;
centerX = mask._x + mask._width / 2;
centerY = mask._y + mask._height / 2;
zoomDistance = mask._width / 2;
dX = _xmouse - clickX;
dY = _ymouse - clickY;
d = Math.sqrt(Math.pow(dx,2) + Math.pow(dy,2));
zp = zp2 = d / zoomDistance;
if (zp>=1) {zp2 = 1;}
scale = zoomFirstScale + zp * zoomMax;
z._xscale = z._yscale = scale;
z._x = clickX - scale / zoomFirstScale * (clickX-zoomFirstX) + zp2 * (centerX-clickX);
z._y = clickY - scale / zoomFirstScale * (clickY-zoomFirstY) + zp2 * (centerY-clickY);
}
function panMove() {
// need to add limits
zoomPic._x = zoomPanX + (_xmouse - panClickX);
zoomPic._y = zoomPanY + (_ymouse - panClickY);
limits(zoomPic);
}
function limits(c) {
if (zoomOriginalX > mask._x) {
if (c._x > zoomOriginalX) {
c._x = zoomOriginalX;
}
} else {
if (c._x > mask._x) {
c._x = mask._x;
}
}
if (zoomOriginalX + zoomOriginalW < mask._x + mask._width) {
if (c._x + c._width < zoomOriginalX + zoomOriginalW) {
c._x = zoomOriginalX + zoomOriginalW - c._width;
}
} else {
if (c._x + c._width < mask._x + mask._width) {
c._x = mask._x + mask._width - c._width;
}
}
if (zoomOriginalY > mask._y) {
if (c._y > zoomOriginalY) {
c._y = zoomOriginalY;
}
} else {
if (c._y > mask._y) {
c._y = mask._y;
}
}
if (zoomOriginalY + zoomOriginalH < mask._y + mask._height) {
if (c._y + c._height < zoomOriginalY + zoomOriginalH) {
c._y = zoomOriginalY + zoomOriginalH - c._height;
}
} else {
if (c._y + c._height < mask._y + mask._height) {
c._y = mask._y + mask._height - c._height;
}
}
}
mask.onMouseMove = function() {
if (zoomCheck != 0) {
if (zoomCheck == 1) {
zoomMove(1);
} else if (zoomCheck == 4) {
zoomMove(-1);
} else if (panCheck == 1) {
panMove();
}
} else {
if (mouseMoveCheck == 0 && mouseIntervalCheck == 0) {
mouseIntervalCheck = 1
mouseID = setInterval(mouseMoved,500);
}
}
}
function doubleClear() {
doubleCheck = 0;
clearInterval(doubleID);
}
function unzoom(pic) {
panCheck = 0;
zoomCheck = 5;
if (pic != null && pic != undefined) {
zoomBack(pic);
} else {
if (rssCheck) {
zoomBack();
} else {
zoomPic.slideTo(zoomOriginalX,zoomoriginalY, zoomBackDuration, "easeInOutCubic");
zoomPic.scaleTo(zoomOriginalScale, zoomBackDuration, "easeInOutCubic",0,zoomBack);
}
}
}
function zoomBack(pic) {
zoomPic._x = zoomOriginalX;
zoomPic._y = zoomoriginalY;
zoomPic._xscale = zoomPic._yscale = zoomOriginalScale;
zoomCheck = 0;
panCheck = 0;
pastPanCheck = 0;
firstZoomCheck = 0;
zoomPic.swapDepths(lastDepth);
if (pic && fitCheck != 1) {
gotoPic2(pic);
}
}
function clickPicture() {
if (fitCheck == 1) {unFit(this); return;}
if (zoomCheck != 0 && this != zoomPic) {
return;
}
if (zoomCheck == 0) {
zoomFirstX = this._x;
zoomFirstY = this._y;
zoomFirstScale = this._xscale;
firstZoomCheck++;
if (firstZoomCheck == 1) {
zoomOriginalX = this._x;
zoomOriginalY = this._y;
zoomOriginalW = this._width;
zoomOriginalH = this._height;
zoomOriginalScale = this._xscale;
}
zoomCheck = 1;
clickX = _xmouse;
clickY = _ymouse;
zoomPic = this;
lastDepth = this.getDepth();
//trace (lastDepth);
this.swapDepths(980);
panCount = 0;
} else if (zoomCheck == 1 || zoomCheck == 3) {
if (doubleCheck == 1) {
unzoom();
} else {
panClickX = _xmouse;
panClickY = _ymouse;
zoomPanX = zoomPic._x;
zoomPanY = zoomPic._y;
panCheck = 1;
zoomCheck = 2;
doubleCheck = 1;
clearInterval(doubleID);
doubleID = setInterval(doubleClear,250);
//trace ("p="+panCheck);
//trace ("zoom="+zoomCheck);
}
}
if (singleCheck == 0) {
singleCheck = 1;
clearInterval(singleQuickID);
singleQuickID = setInterval(singleClear,250);
}
}
function singleClear() {
singleCheck = 0;
}
mask.onMouseUp = function() {
if (panCheck == 1 && singleCheck == 1) {
panCount++;
if (panCount > 1) {
zoomCheck = 0;
panCheck = 0;
clickPicture.call(zoomPic);
}
}
if (zoomCheck == 2) {
panCheck = 0;
zoomCheck = 3;
}
}
///////////////////// ZenPicture 1 code //////////////////
function getDescription(which) {
if (which != lastWhich) {
viewerText.text = description[which];
lastWhich = which
lastToggle = soundToggle;
soundToggle = (lastToggle%2)+1;
if (mp3[which] != lastSound) {
fadeCross(lastSound, mp3[which],lastToggle,soundToggle,2);
lastSound = mp3[which];
}
popPic = which;
}
}
function fadeCross(oldS,newS,oldObject,newObject,t) {
oldO = this["ms" + oldObject];
oldO.setVolume(100);
newO = this["ms" + newObject];
newO.loadSound(newS, true);
currsound = newS;
newO.onSoundComplete = function() {
v = newO.getVolume();
newO.loadSound(currsound, true);
newO.setVolume(v);
}
newO.setVolume(0);
clearInterval(fadeCrossID);
fspeed = 100;
ft = 100 / (t * 1000 / fspeed);
fadeCrossID = setInterval(fadeCross2,fspeed);
}
function fadeCross2() {
oldO.setVolume(oldO.getVolume() - ft);
if (oldO.getVolume() <=0) {
oldO.stop();
clearInterval(fadeCrossID);
}
newO.setVolume(newO.getVolume() + ft);
if (newO.getVolume() >= 100) {
clearInterval(fadeCrossID);
}
}
function prepare() {
clickOption = this.childNodes[0].attributes.clickpic;
clickOption = "on";
bmp3 = this.childNodes[0].attributes.backgroundmp3;
if (bmp3 != "" && bmp3 != null && bmp3 != undefined) {
bs.loadSound(bmp3, true);
bs.onSoundComplete = function() {
bs.loadSound(bmp3, true);
}
}
pictures = [];
description = [];
mp3 = [];
flickr = [];
temp = this.childNodes[0].attributes.bgcolor;
if (temp.substr(0,1) == "#") {
bcolor = "0x"+temp.substr(1,temp.length-1);
} else {
bcolor = "0x"+temp;
}
if (bcolor != "0x") {
myColor = new Color(_parent.bg);
myColor.setRGB(bcolor);
_parent.menu.sl_color = bcolor;
_parent.menu.sl_barcolor = bcolor;
}
temp = this.childNodes[0].attributes.textcolor;
if (temp.substr(0,1) == "#") {
tcolor = "0x"+temp.substr(1,temp.length-1);
} else {
tcolor = "0x"+temp;
}
if (tcolor != "0x") {
_parent.pictureLabel.textColor = tcolor;
}
//_root.testit.text = "test me";
//rss = "ddd"
rss = _root._url.split("rss=")[1];
//rss = rss.split("&")[0];
if (rss != "" && rss != undefined) {
myXML2 = new XML();
myXML2.ignoreWhite = true
myXML2.onLoad = prepare2;
rssCheck = true;
xmlString = "<rss><file value=\""+rss+"\"/></rss>";
sendThisXML = new XML(xmlString);
sendThisXML.contentType = "text/xml";
sendThisXML.sendAndLoad("getrss.php?rand="+Math.floor(Math.random()*100000), myXML2, POST); //receive to myXML
// check to see if it redirects to rss feed
} else if (this.childNodes[0].attributes.rss != "" && this.childNodes[0].attributes.rss != undefined) {
myXML2 = new XML();
myXML2.ignoreWhite = true
myXML2.onLoad = prepare2;
rssCheck = true;
xmlString = "<rss><file value=\""+this.childNodes[0].attributes.rss+"\"/></rss>";
sendThisXML = new XML(xmlString);
sendThisXML.contentType = "text/xml";
sendThisXML.sendAndLoad("getrss.php?rand="+Math.floor(Math.random()*100000), myXML2, POST); //receive to myXML
} else {
// otherwise it is a zenpicture format
pList = this.childNodes[0].childNodes
for (i=0; i<pList.length; i++) {
pictures.push(pList[i].attributes.file)
description.push(pList[i].attributes.caption)
mp3.push(pList[i].attributes.mp3)
}
startPics();
}
}
function prepare2() {
pList = this.childNodes[0].childNodes[0].childNodes
for (i=0; i<pList.length; i++) {
if (pList[i].nodeName == "item") {
tlist = pList[i].childNodes;
for (j=0; j<tlist.length; j++) {
if (tList[j].nodeName == "media:content") {
pictures.push(tList[j].attributes.url);
mp3.push("");
} else if (tList[j].nodeName == "media:title") {
description.push(tList[j].firstChild);
} else if (tList[j].nodeName == "link") {
flickr.push(tList[j].firstChild);
}
}
}
}
startPics();
}
function startPics() {
lastPic = pictures.length-1
clip0 = current.createEmptyMovieClip("p"+currentPic,100)
clip0.loadMovie(pictures[currentPic]);
clip0._x = clip0._y = 2000
if (mp3[0] != undefined && mp3[0] != "") {
ms1.loadSound(mp3[0], true);
ms1.onSoundComplete = function() {
ms1.loadSound(mp3[0], true);
}
lastSound = mp3[0];
}
myPic = clip0
myPic._x = mask._x
maskT = mask._y
maskB = maskT + mask._height
maskL = mask._x
maskR = maskL + mask._width
maskCenterX = maskL + (maskR - maskL) / 2
maskCenterY = maskT + (maskB - maskT) / 2
delay = 500
loading = 0
doneCheck = 0 // not finished loading pictures
spacing = 14 // gap between pictures
clearInterval(current.loaderID);
current.loaderID = setInterval(loadNext, delay);
clearInterval(current.speedID);
current.speedID = setInterval(checkSpeed,257);
}
myListener = new Object();
myListener.onKeyUp = function () {
if (Key.getCode() == Key.LEFT || Key.getCode() == Key.DOWN) {
keyPic = currentPic - 1;
if (keyPic < 0) {keyPic = pictures.length-1;}
currentDirection = 1;
gotoPic(keypic);
} else if (Key.getCode() == Key.RIGHT || Key.getCode() == Key.UP) {
keyPic = currentPic + 1;
if (keyPic > pictures.length-1) {keyPic = 0;}
currentDirection = -1;
gotoPic(keypic);
} else if (Key.getCode() == Key.SPACE) {
if (keyPause == 0) {
keyLastSpeedX = xSpeed;
keyLastSpeedY = ySpeed;
xSpeed = ySpeed = 0;
keyPause = 1;
mouseMoveCheck = 0;
} else {
xSpeed = keyLastSpeedX;
ySpeed = keyLastSpeedY;
keyPause = 0;
mouseMoveCheck = 1;
}
}
}
Key.addListener(myListener);
function gotoPic(pic) {
if (doneCheck == 0) {
if (pic + 1 >= loading) {
return;
}
}
mouseMoveCheck = 0
if (fitCheck == 1) {
unzoom(pic);
gotoPic2(pic);
changeFit(myPic);
} else {
if (zoomCheck > 0) {
unzoom(pic);
} else {
gotoPic2(pic);
}
}
//trace ("pic="+pic);
//trace ("myPic="+myPic);
}
function gotoPic2(pic) {
for (i=0; i<pictures.length; i++) {
current["p"+i]._x = current["p"+i]._y = 2000
}
myPic = current["p"+pic];
if (myPic._width > myPic._height) {
orient = "h"
xSpeed = speed * currentDirection
ySpeed = 0
myPic._xscale = myPic._yscale = mask._height / myPic.h * 100
if (currentDirection < 0) {
myPic._x = mask._x
myPic._y = mask._y
} else {
myPic._x = mask._x - (myPic._width - mask._width)
myPic._y = mask._y
}
} else {
orient = "v"
xSpeed = 0
ySpeed = speed * currentDirection
myPic._xscale = myPic._yscale = mask._width / myPic.w * 100
if (currentDirection < 0) {
myPic._x = mask._x
myPic._y = mask._y - (myPic._height - mask._height)
} else {
myPic._x = mask._x
myPic._y = mask._y
}
}
if (clickOption == "on") {myPic.onPress = clickPicture}
delete nextPic
readyCheck = 0
currentPic = pic
getDescription(pic)
}
function loadNext() {
if (current["clip"+loading]._width > 2) {
current["clip"+loading].w = current["clip"+loading]._width;
current["clip"+loading].h = current["clip"+loading]._height;
loading++;
if (loading == 2) {loadStart();}
if (loading >= pictures.length) {
clearInterval(loaderID);
doneCheck = 1;
callBack();
return;
}
current["clip"+loading] = createEmptyMovieClip("p"+loading,100+loading)
current["clip"+loading]._x = current["clip"+loading]._y = 2000;
current["clip"+loading].loadMovie(pictures[loading]);
}
}
function loadStart() {
goCheck = 1;
if (myPic._width > myPic._height) {
orient = "h"
myPic._xscale = myPic._yscale = mask._height / myPic.h * 100
xSpeed = speed * currentDirection
ySpeed = 0
myPic._x = mask._x
myPic._y = mask._y
} else {
orient = "v"
myPic._xscale = myPic._yscale = mask._width / myPic.w * 100
xSpeed = 0
ySpeed = speed * currentDirection
myPic._x = mask._x
myPic._y = mask._y - (myPic._height - mask._height)
}
viewerText.text = description[currentPic];
if (clickOption == "on") {clip0.onPress = clickPicture;}
}
function getNextPic() {
delete myPic
myPic = myPic2
delete myPic2
readyCheck = 0
mouseMoveCheck = 0
currentPic = nextPic
delete nextPic
xSpeed = nextXSpeed;
ySpeed = nextYSpeed;
orient = nextOrient
if (orient == "h") {
myPic._y = mask._y
myPic._xscale = myPic._yscale = mask._height / myPic.h * 100
} else {
myPic._x = mask._x
myPic._xscale = myPic._yscale = mask._width / myPic.w * 100
}
//trace ("goes off")
}
function setNextPic() {
if (!nextPic) {
nextPic = currentPic - currentDirection;
if (nextPic >= pictures.length) {
nextPic = 0;
}
if (nextPic < 0) {
nextPic = pictures.length - 1
}
}
myPic2 = current["p"+nextPic];
if (myPic2._width > myPic2._height) {
nextXSpeed = speed * currentDirection
nextYSpeed = 0
nextOrient = "h"
} else {
nextXSpeed = 0
nextYSpeed = speed * currentDirection
nextOrient = "v"
}
//if (myPic2._xscale == 100) {
if (nextOrient == "h"){
myPic2._xscale = myPic2._yscale = mask._height / myPic2.h * 100
} else {
myPic2._xscale = myPic2._yscale = mask._width / myPic2.w * 100
}
//}
// 8 possible configurations based on direction and orientations
if (currentDirection < 0) {
if (orient == "h") {
if (nextOrient == "h") {
myPic2._x = myPic._x + (myPic._width + spacing)
myPic2._y = myPic._y
} else {
myPic2._x = myPic._x + (myPic._width + spacing)
myPic2._y = myPic._y - (myPic2._height - myPic._height)
}
} else {
if (nextOrient == "h") {
myPic2._x = myPic._x
myPic2._y = myPic._y - (myPic2._height + spacing)
} else {
myPic2._x = myPic._x
myPic2._y = myPic._y - (myPic2._height + spacing)
}
}
} else {
if (orient == "h") {
if (nextOrient == "h") {
myPic2._x = myPic._x - (myPic2._width + spacing)
myPic2._y = myPic._y
} else {
myPic2._x = myPic._x - (myPic2._width + spacing)
myPic2._y = myPic._y
}
} else {
if (nextOrient == "h") {
myPic2._x = myPic._x - (myPic2._width - myPic._width)
myPic2._y = myPic._y + (myPic._height + spacing)
} else {
myPic2._x = myPic._x
myPic2._y = myPic._y + (myPic._height + spacing)
}
}
}
if (clickOption == "on") {myPic2.onPress = clickPicture;}
readyCheck = 1
}
onEnterFrame = function() {
for (i=0; i<cursors.length; i++) {
cursors[i]._visible = false;
}
if (doneCheck == 0) {
if (currentPic == 0 && currentDirection > 0) {
if (zoomCheck == 0) {
if (lastCursor == "") {
cursorWait.gotoAndPlay(1);
lastCursor = 1;
}
if (mask.hitTest(_xmouse, _ymouse, false)) {
cursorWait._visible = true;
cursorWait._x = _xmouse;
cursorWait._y = _ymouse;
Mouse.hide();
mouseShowCheck = 0;
if (_xmouse < 2 || _ymouse < 2) {
normalCursor();
}
} else {
normalCursor();
}
return;
}
}
if (currentPic + 1 >= loading && currentDirection < 0) {
if (zoomCheck == 0) {
if (lastCursor == "") {
cursorWait.gotoAndPlay(1);
lastCursor = 1;
}
if (mask.hitTest(_xmouse, _ymouse, false)) {
cursorWait._visible = true;
cursorWait._x = _xmouse;
cursorWait._y = _ymouse;
if (_xmouse < 2 || _ymouse < 2) {
normalCursor();
}
} else {
normalCursor();
}
return;
}
}
} else {
lastCursor = "";
}
if (fitCheck == 1) {
if (mask.hitTest(_xmouse, _ymouse, false)) {
cursorSlide._visible = true;
cursorSlide._x = _xmouse;
cursorSlide._y = _ymouse;
if (speed == 0) {
cursorSlide.gotoAndStop(2);
} else {
cursorSlide.gotoAndStop(1);
}
Mouse.hide();
mouseShowCheck = 0;
if (_xmouse < 2 || _ymouse < 2) {
normalCursor();
}
} else {
normalCursor();
}
fitTally++;
if (speed == 0 || keyPause == 1) {fitTally = 0;}
if (fitTally / frameRate > maxSpeed + 1 - speed) {
if (currentDirection < 0) {
fitPic = currentPic + 1;
if (fitPic > pictures.length-1) {fitPic = 0;}
gotoPic(fitPic);
} else {
fitPic = currentPic - 1;
if (fitPic < 0) {fitPic = pictures.length-1;}
gotoPic(fitPic);
}
fitTally = 0;
}
return;
}
if (mask.hitTest(_xmouse, _ymouse, false)) {
Mouse.hide();
mouseShowCheck = 0;
if (panCheck == 1) {
cursorPan2._visible = true;
cursorPan2._x = _xmouse;
cursorPan2._y = _ymouse;
} else if (zoomCheck == 1) {
cursorZoom._visible = true;
cursorZoom._x = _xmouse;
cursorZoom._y = _ymouse;
} else if (zoomCheck > 2 && zoomCheck < 5) {
cursorPan._visible = true;
cursorPan._x = _xmouse;
cursorPan._y = _ymouse;
} else {
cursorSlide._visible = true;
cursorSlide._x = _xmouse;
cursorSlide._y = _ymouse;
if (speed == 0) {
cursorSlide.gotoAndStop(2);
} else {
cursorSlide.gotoAndStop(1);
}
}
if (_xmouse < 2 || _ymouse < 2) {
normalCursor();
}
} else {
normalCursor();
}
if (goCheck == 0) {return;}
if (zoomCheck != 0) {return;}
myPic._x += xSpeed;
myPic._y -= ySpeed;
myPic2._x += xSpeed;
myPic2._y -= ySpeed;
if (readyCheck != 1) { // then we still need to set upcoming picture
if (xSpeed < 0) { // left
if (myPic._x <= maskL) {
setNextPic()
}
} else if (xSpeed > 0) { // right
if (myPic._x + myPic._width >= maskR) {
setNextPic()
}
} else if (ySpeed < 0) { // up
if (myPic._y + myPic._height >= maskB) {
setNextPic()
}
} else if (ySpeed > 0) { // down
if (myPic._y <= maskT) {
setNextPic()
}
}
} else { // check to see if we need to switch the picture
if (currentDirection < 0) {
if (orient == "h") {
if (myPic._x <= maskL - (myPic._width + spacing)) {
getNextPic()
}
} else {
if (myPic._y >= maskB + spacing) {
getNextPic()
}
}
} else {
if (orient == "h") {
if (myPic._x > maskR + spacing) {
getNextPic()
}
} else {
if (myPic._y < maskT - (myPic._height + spacing)) {
getNextPic()
}
}
}
}
if (currentDirection < 0) { // get halfway point for description change
if (orient == "h") {
if (myPic._x <= maskCenterX - (myPic._width)) {
getDescription(nextPic)
} else {
getDescription(currentPic)
}
} else {
if (myPic._y >= maskCenterY) {
getDescription(nextPic)
} else {
getDescription(currentPic)
}
}
} else {
if (orient == "h") {
if (myPic._x > maskCenterX) {
getDescription(nextPic)
} else {
getDescription(currentPic)
}
} else {
if (myPic._y < maskCenterY - myPic._height) {
getDescription(nextPic)
} else {
getDescription(currentPic)
}
}
}
}
function normalCursor() {
if (mouseShowCheck == 0) {
Mouse.show();
mouseShowCheck = 1;
}
for(var i=0; i<cursors.length; i++) {
cursors[i]._visible = false;
}
}
function checkSpeed() {
if (mask.hitTest(_xmouse,_ymouse) && mouseMoveCheck == 1) {
if (orient == "h") {
locX = (_xmouse - maskL) / mask._width * 100
minBorder = 50 - noSpeedRange / 2
maxBorder = 50 + noSpeedRange / 2
if (locX < minBorder) {
speed = (minBorder - locX) / minBorder * maxSpeed
currentDirection = 1
} else if (locX > maxBorder) {
speed = (locX - maxBorder) / minBorder * maxSpeed
currentDirection = -1
} else {
speed = 0
}
xSpeed = speed * currentDirection
} else {
locY = (_ymouse - maskT) / mask._height * 100
minBorder = 50 - noSpeedRange / 2
maxBorder = 50 + noSpeedRange / 2
if (locY < minBorder) {
speed = (minBorder - locY) / minBorder * maxSpeed
currentDirection = -1
} else if (locY > maxBorder) {
speed = (locY - maxBorder) / minBorder * maxSpeed
currentDirection = 1
} else {
speed = 0
}
ySpeed = speed * currentDirection
}
if (nextOrient == "h") {
nextXSpeed = speed * currentDirection
} else {
nextYSpeed = speed * currentDirection
}
}
if (currentDirection != lastDirection) {
readyCheck = 0;
lastDirection = currentDirection
delete nextPic
}
}
function mouseMoved() {
//xSpeed = keyLastSpeedX;
//ySpeed = keyLastSpeedY;
keyPause = 0;
mouseMoveCheck = 1
mouseIntervalCheck = 0
clearInterval(mouseID)
}