Error # 1120, Access of undefined property ERROR. AS3
I have a code inside of an actionscript file, and i receive multiple errors when attempting to debug:
1120: Access of undefined property square.
1180: Call to a possibly undefined method addChild.
1120: Access of undefined property square.
1120: Access of undefined property square.
1120: Access of undefined property fl_click.
1120: Access of undefined property myTimer.
1120: Access of undefined property timerListener.
1120: Access of undefined property myTimer.
Here is my code for my main actionscript file:
package
{
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
public class Game extends MovieClip
{
public var myTimer:Timer = new Timer(50);
public var square:Square;
square.addEventListener(MouseEvent.CLICK, fl_click);
myTimer.addEventListener(TimerEvent.TIMER, timerListener);
myTimer.start();
private function timerListener(e:TimerEvent):void
{
square.edgeCorrect;
}
private function fl_click(event:MouseEvent):void
{
square.moveDownABit();
}
public function Game();
{
square = new Square();
addChild( square );
}
I am a beginner, so please tell me specifically what to do with my code, thanks!
