使用 Flash Professional CS5,我试图在我的脚本中添加一个子对象。我想在创建时将创建子对象的类作为参数提供。问题是当我尝试测试项目时,我收到一条错误消息Incorrect number of arguments. 0 expected.
我的MainClass.as
:
package {
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class MainClass extends MovieClip {
var menuClass:MenuClass;
var gameClass:GameClass;
var highClass:HighscoreClass;
public function Main() {
this.StartOfProject();
}
public function StartOfProject() {
menuClass = new MenuClass(this);
this.addChild(menuClass);
highClass = new HighscoreClass();
}
我的MenuClass.as
:
package {
public class MenuClass extends MovieClip {
var mainClass:MainClass;
public function Menu(mainClass:MainClass) {
this.mainClass = mainClass;
...
}
我究竟做错了什么?