I’m trying to set up a website for a client where I believe I need to set up a variable to know what button has been clicked already.
The site is
http://thepaperplant.com/oakfoto/site.html
When the site loads there are 3 different image galleries with masks set on each one to only show a portion of each image. When you click on one of the galleries that mask is removed and it shows the full image. When this happens the other galleries below move down to make room for the full image.
I defined a variable that when you click on a new button/movie (People/Places/Things) the variable gets defined as “people”, “places” or “things”. But I cannot get it to do anything but the default variable click – the ‘else’ in my if/else statement.
If anyone can be of assistance it would be greatly appreciated.
var current_gallery;
if (current_gallery == "people") {
pageloaderB.addEventListener(MouseEvent.CLICK, movePlaces2);
} else if (current_gallery == "places") {
pageloaderA.addEventListener(MouseEvent.CLICK, movePeople2);
}
else {
pageloaderA.addEventListener(MouseEvent.CLICK, movePeople);
pageloaderB.addEventListener(MouseEvent.CLICK, movePlaces);
}
// default action
function movePeople(event:MouseEvent):void {
current_gallery = "people";
pageloaderA.mask = null;
removeChild(maskA_mc);
movePlacesTween = new Tween(pageloaderB, "y", Strong.easeOut, pageloaderB.y, pageloaderB.y + 400, 0.5, true);
moveMaskBTween = new Tween(maskB_mc, "y", Strong.easeOut, maskB_mc.y, maskB_mc.y + 400, 0.5, true);
moveFooter = new Tween(footer, "y", Strong.easeOut, footer.y, footer.y + 400, 0.5, true);
movePlacesOverBox = new Tween(PlacesOverBox, "y", Strong.easeOut, PlacesOverBox.y, PlacesOverBox.y + 400, 0.5, true);
moveThingsOverBox = new Tween(ThingsOverBox, "y", Strong.easeOut, ThingsOverBox.y, ThingsOverBox.y + 400, 0.5, true);
PeopleOverBox.alpha = 0;
people.visible = false;
trace (current_gallery);
}
// if Places is open
function movePeople2(event:MouseEvent):void {
current_gallery = "people";
pageloaderA.mask = null;
removeChild(maskA_mc);
this.addChild(maskB_mc);
pageloaderB.mask = maskB_mc;
maskB_mc.visible = true;
movePlacesTween = new Tween(pageloaderB, "y", Strong.easeOut, pageloaderB.y, pageloaderB.y + 400, 0.5, true);
this.addChild(maskB_mc);
pageloaderB.mask = maskB_mc;
maskB_mc.visible = true;
moveMaskBTween = new Tween(maskB_mc, "y", Strong.easeOut, maskB_mc.y, maskB_mc.y + 400, 0.5, true);
moveFooter = new Tween(footer, "y", Strong.easeOut, footer.y, footer.y + 400, 0.5, true);
movePlacesOverBox = new Tween(PlacesOverBox, "y", Strong.easeOut, PlacesOverBox.y, PlacesOverBox.y + 400, 0.5, true);
moveThingsOverBox = new Tween(ThingsOverBox, "y", Strong.easeOut, ThingsOverBox.y, ThingsOverBox.y + 400, 0.5, true);
PeopleOverBox.alpha = 0;
people.visible = false;
trace (current_gallery);
}
// default action
function movePlaces(event:MouseEvent):void {
current_gallery = "places";
this.addChild(maskA_mc);
pageloaderA.mask = maskA_mc;
maskA_mc.visible = true;
pageloaderB.mask = null;
removeChild(maskB_mc);
moveThingsTween = new Tween(pageloaderC, "y", Strong.easeOut, pageloaderC.y, pageloaderC.y + 400, 0.5, true);
moveMaskCTween = new Tween(maskC_mc, "y", Strong.easeOut, maskC_mc.y, maskC_mc.y + 400, 0.5, true);
moveFooter = new Tween(footer, "y", Strong.easeOut, footer.y, footer.y + 400, 0.5, true);
moveThingsOverBox = new Tween(ThingsOverBox, "y", Strong.easeOut, ThingsOverBox.y, ThingsOverBox.y + 400, 0.5, true);
PlacesOverBox.alpha = 0;
places.visible = false;
pageloaderB.removeEventListener(MouseEvent.MOUSE_OVER, drawPlacesBox);
trace (current_gallery);
}
//use if people is open
function movePlaces2(event:MouseEvent):void {
current_gallery = "places";
this.addChild(maskA_mc);
pageloaderA.mask = maskA_mc;
maskA_mc.visible = true;
pageloaderB.mask = null;
removeChild(maskB_mc);
movePlacesTween = new Tween(pageloaderB, "y", Strong.easeOut, pageloaderB.y, pageloaderB.y - 400, 0.5, true);
moveThingsTween = new Tween(pageloaderC, "y", Strong.easeOut, pageloaderC.y, pageloaderC.y + 400, 0.5, true);
moveMaskCTween = new Tween(maskC_mc, "y", Strong.easeOut, maskC_mc.y, maskC_mc.y + 400, 0.5, true);
moveFooter = new Tween(footer, "y", Strong.easeOut, footer.y, footer.y + 400, 0.5, true);
moveThingsOverBox = new Tween(ThingsOverBox, "y", Strong.easeOut, ThingsOverBox.y, ThingsOverBox.y + 400, 0.5, true);
PlacesOverBox.alpha = 0;
places.visible = false;
pageloaderB.removeEventListener(MouseEvent.MOUSE_OVER, drawPlacesBox);
trace (current_gallery);
}