user3526964
user3526964

Reputation: 3

Error 1026 Constructor Functions must be instance methods

I have created an input and output box. the code isn't working and the error message is
1026: Constructor functions must be instance method.

I have checked all my instances and they are correct - so which bit am I missing.

Here is the code I used:

Frame 1 Action Code:

//starting input boxes//
var myText : String;

/*create event handler*/
btnNext.addEventListener(MouseEvent.CLICK, nextClick); 

function nextClick(myNextEvent:MouseEvent):void 
{ 
    captureText(); 
    this.nextFrame(); 
}  

function captureText():void 
{ 
    myText = txtInput.text;
}

Frame 2 Action:

/*output the following*/
txtOutput.text = "Hello "+myText+" Thanks for joining in!"; 

/*making back button work*/
btnBack.addEventListener(MouseEvent.CLICK,backClick);

function backClick(myBackEvent:MouseEvent):void 
{
    this.prevFrame();
}

I have two buttons on stage, btnBack and btnNext, with instances of the same name an input and output box with instance names of txtInput and txtOutput.

Upvotes: 0

Views: 1916

Answers (1)

Zhafur
Zhafur

Reputation: 1624

Error #1026 is naming conflict, the code you pasted in has nothing to do with classes, check if there are more functions with the name of the class, or if there is any static function which has the same name as the class.

Upvotes: 2

Related Questions