task05

Joshua Piersanti

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

The biggest problem I ran into was making the clouds keep moving smoothly throughout the whole animation, without jumping at the start of a scene. This turned out to be simple: the clouds are a movie clip on their own layer and the four scenes are inside a movie clip on another layer, but it took me a while to figure that out because I didn't have my animations set up that way.

If I had known before I started making the animations what I would have to do to make them work together and be clickable, I would have made a much more simplified timeline.

Here is the code for the main timeline:

import flash.events.MouseEvent;

function hand(e:MouseEvent):void {
	buttonMode=true;
}
function offhand(e:MouseEvent):void {
	buttonMode=false;
}
function over_car(e:MouseEvent):void {
	car2.gotoAndPlay("GROW");
}
function over_girl(e:MouseEvent):void {
	girl.gotoAndPlay("GROW");
}
function over_trees(e:MouseEvent):void {
	main.trees.gotoAndPlay("GROW");
}
function over_sun(e:MouseEvent):void {
	main.sun.gotoAndPlay("GROW");
}

car2.addEventListener(MouseEvent.MOUSE_DOWN, main.click_car);
car2.addEventListener(MouseEvent.ROLL_OVER, hand);
car2.addEventListener(MouseEvent.ROLL_OUT, offhand);
car2.addEventListener(MouseEvent.ROLL_OVER, over_car);

girl.addEventListener(MouseEvent.MOUSE_DOWN, main.click_girl);
girl.addEventListener(MouseEvent.ROLL_OVER, hand);
girl.addEventListener(MouseEvent.ROLL_OUT, offhand);
girl.addEventListener(MouseEvent.ROLL_OVER, over_girl);

main.trees.addEventListener(MouseEvent.MOUSE_DOWN, main.click_trees);
main.trees.addEventListener(MouseEvent.ROLL_OVER, hand);
main.trees.addEventListener(MouseEvent.ROLL_OUT, offhand);
main.trees.addEventListener(MouseEvent.ROLL_OVER, over_trees);

main.sun.addEventListener(MouseEvent.MOUSE_DOWN, main.click_sun);
main.sun.addEventListener(MouseEvent.ROLL_OVER, hand);
main.sun.addEventListener(MouseEvent.ROLL_OUT, offhand);
main.sun.addEventListener(MouseEvent.ROLL_OVER, over_sun);

Here is some of the code from the timeline containing the animation movie clip:

import flash.events.MouseEvent;

function click_car(e:MouseEvent):void {
	MovieClip(parent).car2.alpha = 0;
	MovieClip(parent).girl.alpha = 0;
	gotoAndPlay("CAR");
}
function click_girl(e:MouseEvent):void {
	MovieClip(parent).car2.alpha = 0;
	MovieClip(parent).girl.alpha = 0;
	gotoAndPlay("GIRL");
}
function click_trees(e:MouseEvent):void {
	gotoAndPlay("TREES");
	MovieClip(parent).girl.alpha = 0;
}
function click_sun(e:MouseEvent):void {
	gotoAndPlay("SUN");
}

stop();