package { import flash.display.*; import flash.events.*; import flash.text.*; import flash.utils.Timer; import flash.media.Sound; import flash.media.SoundChannel; import flash.net.URLRequest; public class RobertMemoryGame extends Sprite { static const numLights:uint = 5; private var lights:Array; //list of light objects private var playOrder:Array; //growing memorization list, copy to repeatOrder private var repeatOrder:Array; //array for player to repeat private var textMessage:TextField; private var textScore:TextField; private var lightTimer:Timer; private var offTimer:Timer; var gameMode:String; var currentSelection:MovieClip = null; var soundList:Array = new Array(); //list of sounds var datPlay:PlayButton = new PlayButton(); public function RobertMemoryGame() { datPlay.x = 275 datPlay.y = 200 addChild(datPlay); datPlay.addEventListener(MouseEvent.CLICK,robertStartGame); datPlay.buttonMode = true; } public function robertStartGame(event:MouseEvent) { removeChild(datPlay); var ar24 = new TextFormat(); ar24.font = "Arial"; ar24.color = 0xFFFFFF ar24.size = 24; ar24.align = "center"; textMessage = new TextField(); textMessage.width = 550; textMessage.y = 110; textMessage.selectable = false; textMessage.defaultTextFormat = ar24; addChild(textMessage); textScore = new TextField(); textScore.width = 550; textScore.y = 250; textScore.selectable = false; textScore.defaultTextFormat = ar24; addChild(textScore); soundList = new Array(); for(var i:uint=1;i<=5;i++) { var thisSound:Sound = new Sound(); var req:URLRequest = new URLRequest("note"+i+".mp3"); thisSound.load(req); soundList.push(thisSound); } lights = new Array(); for(i=0;i