Access of undefined property (dynamic text box)
Hi guys,
I have a movie clip working as a button that is disabled after click. I need to add a scoring option, so that on click it also adds to the score. When I add the scoreGame function, it says the text box is undefined. Ideas?
Here's the code:
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class DisablingButtons extends MovieClip
{
var labels:Array;
var thisParent:*;
var score:Number = 0;
var goalScore:Number = 8;
public function DisablingButtons()
{
trace("it's working!");
labels = this.currentLabels;
this.addEventListener(MouseEvent.CLICK, scoreGame);
this.addEventListener(MouseEvent.CLICK, disableButton);
this.addEventListener(MouseEvent.ROLL_OVER, over);
this.addEventListener(MouseEvent.ROLL_OUT, out);
}
function scoreGame(myEvent:MouseEvent):void
{
score++;
score1.text = String(score);
if (score == goalScore)
{
gotoAndStop(201);
}
}
function disableButton(event:MouseEvent):void
{
for (var i:int = 0; i < labels.length; i++)
{
if (labels.name == "disable")
{
this.gotoAndPlay("disable");
}
}
this.removeEventListener(MouseEvent.CLICK, disableButton);
this.removeEventListener(MouseEvent.ROLL_OVER, over);
this.removeEventListener(MouseEvent.ROLL_OUT, out);
}
function over(event:MouseEvent):void
{
for (var j:int = 0; j < labels.length; j++)
{
if (labels
{
this.gotoAndPlay("over");
}
}
}
function out(event:MouseEvent):void
{
for (var k:int = 0; k < labels.length; k++)
{
if (labels
{
this.gotoAndPlay("out");
}
}
}
}
}