Actionscript 3 actionscript 3错误1136:参数数量不正确。预期1
当我调用一个方法时,我得到了1136错误,它说我需要一个参数,但我没有请求任何参数:Actionscript 3 actionscript 3错误1136:参数数量不正确。预期1,actionscript-3,flash-cs5,Actionscript 3,Flash Cs5,当我调用一个方法时,我得到了1136错误,它说我需要一个参数,但我没有请求任何参数: 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.Key
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);
}
我对actionscript和编程非常陌生,请帮助 你不能像这样调用构造函数
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
{
}
}
这个错误很容易解决,但是如果你能将你得到的错误作为一个整体(输出中的所有内容)发布出来,这将提供非常有用的信息,比如你调用的方法是什么导致了这个错误。谢谢你的帮助,我仍然会遇到错误,但我想我可以自己解决。
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
{
}
}