I am getting a 1056 error in my custom class file and cannot figure out why... Help
Here is the error I am getting:
ReferenceError: Error #1056: Cannot create property button1 on com.sample.PWClass.PClass.
Here is my code:
package com.sample.PWClass {
import flash.display.MovieClip;
import flash.events.MouseEvent;
import flash.text.TextField;
public class PClass extends MovieClip {
private var totalChar=8;// number of chars in the password
private var xcom:String="abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ";
private var xcomnum:String="0123456789";
private var l_length=xcom.length;
private var n_length=xcomnum.length;
private var new_password:String=new String();// set the inital variable
public function PClass() {
button1.addEventListener(MouseEvent.CLICK,onClickHandler);
}
private function onClickHandler(evt:MouseEvent😞void {
mark.text = newPassword();
trace(mark.text);
}
private function newPassword() {
new_password=new String();
for (var i=0; i < totalChar; i++) {// loop and create password
var a=xcom.charAt(Math.floor(Math.random() * l_length));
var b=xcomnum.charAt(Math.floor(Math.random() * n_length));
var char=Math.floor(Math.random() * totalChar) % 2 == 0?a:b;
new_password+= char;
}
return new_password;
}
}
}