-
Error 1063: Argument count mismatch
Hey guys, relatively new to as3, totally stuck on this.
Error message is:
ArgumentError: Error #1063: Argument count mismatch on DisablingButtons(). Expected 1, got 0.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at game_test_fla::MainTimeline()
Code is:
package
{
import flash.text.TextField;
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class DisablingButtons extends MovieClip
{
var labels:Array;
var score:Number = 0;
var goalScore:Number = 8;
var score1:TextField;
public function DisablingButtons(txt:TextField) <--- when I remove this, the error disappears, but property txt is undefined.
{
trace("its working");
score1 = txt;
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(event: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[i].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[j].name == "over")
{
this.gotoAndPlay("over");
}
}
}
function out(event:MouseEvent):void
{
for (var k:int = 0; k < labels.length; k++)
{
if (labels[k].name == "out")
{
this.gotoAndPlay("out");
}
}
}
}
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|