// defining a class called Light, which extends the MovieClip class class Light extends MovieClip { // a class variable var LightState; var xPos; var yPos; var move1_spot; // the class constructor which gets called when you create an object // note: in this case, its called when you start the program, and it sees our light MovieClip on the // first frame function Light() { this.LightState = false; this.onPress = function() { _root.spotPress(xPos, yPos); } } // a class method sets the light's current state function setState(newState:Boolean) { LightState = newState; if (newState) this.gotoAndStop("on"); this.gotoAndStop("off"); } // a class method that switches the light's current state function switchState() { LightState = !LightState; if (LightState) this.gotoAndStop("on"); else this.gotoAndStop("off"); } function move1_spot2() { //this.LightState = false; if (move1_spot) this.gotoAndStop("move1"); } function level01() { LightState = !LightState; if (LightState) this.gotoAndStop("off"); this.gotoAndStop("on"); } function level01_off() { LightState = !LightState; if (LightState) this.gotoAndStop("on"); this.gotoAndStop("off"); } function init(xval:Number, yval:Number) { xPos = xval; yPos = yval; this._x = 51+xPos*50; this._y = 49.5+yPos*50; } }