back to portfolio

Hidden Dances

Michelle Aubrecht

Please install the Flash Player from Adobe to view this content.
Get Adobe Flash player

 

Code Snippet 1 - this code repeats 5 times. It is applied to each door both for the right and left button.

 

/*sets up the program to realize that clicking on another
door triangle requires it to restart scrolling frames*/

var payAttention : int = -1;

//door2
//creats a funciton for alpha on mouse down
function AdvanceRight(e:MouseEvent):void {
rightBtn.alpha = .5;

/*refers to the payAttention variable
- now will start the scolling correctly for this door*/
if ( payAttention != 2 ) {
payAttention = 2;
gotoAndStop("STD1");
} else {
//sets parameters for what frame to use
var frameAdvance = currentFrame+1;
if (frameAdvance >4) {
frameAdvance = 2;
}
gotoAndStop(frameAdvance);
}
}
//adds listener for over, out and down for rightBtn
rightBtn.addEventListener(MouseEvent.MOUSE_DOWN, AdvanceRight);
rightBtn.addEventListener(MouseEvent.MOUSE_OVER, r2);
rightBtn.addEventListener(MouseEvent.MOUSE_OUT, r2out);

//creates function for alpha on out, over, and down
function r2(z:MouseEvent) :void {
rightBtn.alpha = .75;
}
function r2out(z:MouseEvent) :void {
rightBtn.alpha = 1;
}
function upRight(e:MouseEvent):void {
rightBtn.alpha = 1;
}
//it knows when the mouse goes up because of this listener! refers to function above
addEventListener(MouseEvent.MOUSE_UP, upRight);

 

Code Snippet 2

This code refers to the array that calls in the movie clip of the dancers. The clips play at all times, but you can't see them until the frame above the door is selected.

//create an array of the clips for each door

var playDances = ["blank", "blank2", TD1, TD2, TD3, WD1, WD2, WD3, MD1, MD2, MD3];

//open door 2 and then play movie
hit2.addEventListener(MouseEvent.CLICK, openDoor2);

function openDoor2(a:MouseEvent):void {
//keeps the movies from showing until it is slected
TD1.visible = false;
TD2.visible = false;
TD3.visible = false;
//using the array below, it konws which movie to play
playDances [currentFrame].visible = true;
gotoAndPlay("2opening");
}

 

Code Snippet 3

This code makes a tint appear on the images above the doors when you rool over it. When you roll away, it goes back to 0 alpha. I did encounter an error, that I don't know how to fix. But, it seems to work anyway.

//when hover over image above door with mouse - .15 alpha
//when mouse leaves hit area, aplha returns to .0
//Door 1
function alphaUp(h:MouseEvent):void {
hit1.alpha = .15;
}

function alphaDown(h:MouseEvent):void {
hit1.alpha = .0;
}

hit1.addEventListener(MouseEvent.MOUSE_OVER, alphaUp);
hit1.addEventListener(MouseEvent.MOUSE_OUT, alphaDown);