Need Help with Guitar Hero Type of Game

Hello. I am trying to make a game like guitar hero. I am inside the Blue Button’s code and there are some errors. Here is the code:

package {
	import flash.display.MovieClip;
	import flash.ui.Keyboard;
	import flash.events.*;

	public class BlueButton extends MovieClip {
		var _root:Object = MovieClip(root);
		public function BlueButton() {
			this.addEventListener(Event.ADDED, enteredFrame);
			this.addEventListener(Event.ENTER_FRAME, enterFrameFunc);
		}
		public function enterFrameFunc(e:Event) {
			if(this._currentframe > 50){
				destroyButton();
			}
		}
		public function enteredFrame(e:Event) {
			stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressCheck);
		}
		public function keyPressCheck(e:KeyboardEvent) {
			trace("Hey");
		}
		public function destroyButton() {
			this.removeEventListener(Event.ENTER_FRAME, enterFrameFunc);
			stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyPressCheck);
			_root.removeChild(this);
			trace("You are OUTTA HERE!");
		}
	}
}

Problem 1: 1119: Access of possibly undefined property _currentframe through a reference with static type BlueButton.

Problem 2: Can’t attach the Key_Down event listener to the stage…

Please help :slight_smile: :eye: