当我调用一个方法时,我得到1136错误并且它说我需要1个参数,但我没有请求任何参数:
function tutorial()
{
main.arcade.gotoAndStop(5);
gotoAndPlay(2);
Main();
}
这是我打电话的课程
package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class Main extends MovieClip
{
var temp:int;
var temp2:int;
var onLeft:Boolean = true;
var coolDown:int;
var distance:int;
var p2h= new hitBar2();
var p1h= new hitBar();
var roy = new Roy();
var shane = new Shane();
public function Main(){
combat(roy,shane);
}
我对动作脚本和编程很新,请帮助!!!
答案 0 :(得分:0)
你不能像
那样调用构造函数Main();
尝试
var main:Main = new Main();
此外,如果Main类是应用程序主类(入口点),那么您可以执行以下操作。
package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class Main extends MovieClip
{
var temp:int;
var temp2:int;
var onLeft:Boolean = true;
var coolDown:int;
var distance:int;
var p2h= new hitBar2();
var p1h= new hitBar();
var roy = new Roy();
var shane = new Shane();
public function Main()
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init():void
{
removeEventListener(Event.ADDED_TO_STAGE,init);
combat(roy,shane);
}
private function combat(roy:Roy,shane:Shane):void
{
}
}