What am i doing wrong?
the startButton is a button and inside a movieclip (menuScreen)
the instancename of the button is startButton.
Line 12 1120: Access of undefined property startButton.
Line 13 1120: Access of undefined property startButton
package
{
import flash.display.MovieClip;
import flash.display.SimpleButton;
import flash.events.MouseEvent;
public class MenuScreen extends MovieClip
{
var startButton:StartButton;
public function MenuScreen();
{
startButton = new StartButton();
startButton.addEventListener( MouseEvent.CLICK, onClickStart );
}
public function onClickStart( event:MouseEvent ):void
{
dispatchEvent( new NavigationEvent( NavigationEvent.START ) );
}
}
}
You’ve got an extra semicolon on this line:
which is making Flash think the following {} block is unrelated to MenuScreen().
Also, as Johan points out, having a StartButton instance on the timeline means that lines 9 and 12 are essentially already done for you, so you don’t need to declare the variable or create an instance.