Section 1
//MainTimeline (Week7FroggerGameShellV2_fla.MainTimeline)
package Week7FroggerGameShellV2_fla {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.media.*;
import flash.utils.*;
import flash.ui.*;
public dynamic class MainTimeline extends MovieClip {
public var beetle_mc:Frogger;
public var end:MovieClip;
public var Frogger1:MovieClip;
public var Blue1:MovieClip;
public var Red1:MovieClip;
public var Green1:MovieClip;
public var Car1:MovieClip;
public var speedBlue:Number;
public var speedCar:Number;
public var speedRed:Number;
public var speedGreen:Number;
public var soundURL3:URLRequest;
public var sound3:Sound;
public var channel3:SoundChannel;
public var myTimer:Timer;
public function MainTimeline(){
addFrameScript(0, frame1);
}
public function onLoop(_arg1:Event){
var _local2:URLRequest = new URLRequest("squeak.mp3");
var _local3:Sound = new Sound();
_local3.load(_local2);
var _local4:SoundChannel = new SoundChannel();
Blue1.x = (Blue1.x + speedBlue);
Car1.x = (Car1.x + speedCar);
Red1.x = (Red1.x + (speedRed * 2));
Green1.x = (Green1.x + speedGreen);
if (Blue1.x > stage.stageWidth){
Blue1.x = 0;
};
if (Car1.x > stage.stageWidth){
Car1.x = 0;
};
if (Green1.x > stage.stageWidth){
Green1.x = 0;
};
if (Red1.x > stage.stageWidth){
Red1.x = 0;
};
if (Frogger1.hitTestObject(Blue1)){
Frogger1.alpha = 0;
};
if (Frogger1.hitTestObject(Red1)){
Frogger1.alpha = 0;
};
if (Frogger1.hitTestObject(Green1)){
Frogger1.alpha = 0;
};
if (Frogger1.hitTestObject(end)){
_local4 = _local3.play(0, 1);
};
}
public function detectText(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.UP){
Frogger1.rotation = 0;
Frogger1.y = (Frogger1.y - 15);
} else {
if (_arg1.keyCode == Keyboard.LEFT){
Frogger1.rotation = -90;
Frogger1.x = (Frogger1.x - 15);
} else {
if (_arg1.keyCode == Keyboard.RIGHT){
Frogger1.rotation = 90;
Frogger1.x = (Frogger1.x + 15);
} else {
if (_arg1.keyCode == Keyboard.DOWN){
Frogger1.rotation = 180;
Frogger1.y = (Frogger1.y + 15);
};
};
};
};
}
function frame1(){
Frogger1 = new Frogger();
Frogger1.x = 400;
Frogger1.y = 375;
addChild(Frogger1);
Blue1 = new Blue();
Blue1.y = 50;
addChild(Blue1);
Red1 = new Red();
Red1.y = 165;
addChild(Red1);
Green1 = new Green();
Green1.y = 292;
addChild(Green1);
Car1 = new Car();
Car1.y = 225;
addChild(Car1);
speedBlue = 5;
speedCar = 30;
speedRed = 15;
speedGreen = 20;
soundURL3 = new URLRequest("highway.mp3");
sound3 = new Sound();
sound3.load(soundURL3);
channel3 = new SoundChannel();
channel3 = sound3.play(0, 100);
myTimer = new Timer(50, 0);
myTimer.addEventListener(TimerEvent.TIMER, onLoop);
myTimer.start();
stage.addEventListener(KeyboardEvent.KEY_DOWN, detectText);
}
}
}//package Week7FroggerGameShellV2_fla
Section 2
//Blue (Blue)
package {
import flash.display.*;
public dynamic class Blue extends MovieClip {
public function Blue(){
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package
Section 3
//Car (Car)
package {
import flash.display.*;
public dynamic class Car extends MovieClip {
}
}//package
Section 4
//Frogger (Frogger)
package {
import flash.display.*;
public dynamic class Frogger extends MovieClip {
public function Frogger(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 5
//Green (Green)
package {
import flash.display.*;
public dynamic class Green extends MovieClip {
public function Green(){
addFrameScript(0, frame1);
}
function frame1(){
}
}
}//package
Section 6
//Red (Red)
package {
import flash.display.*;
public dynamic class Red extends MovieClip {
}
}//package