「エラー#1063:引数の数が一致しません」というエラーが表示されます。奇妙なことは、それがゲームの実行を維持していないということですが、なぜ私は最初のところでエラーが発生しているのかを知りたいと思います。完全なエラーです:ミステリーエラー#1063:引数の数の不一致
import flashx.textLayout.formats.BackgroundColor;
import flash.display.SimpleButton;
import flash.ui.Mouse;
import flash.text.TextField;
import flash.display.MovieClip;
import flash.events.Event;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.events.MouseEvent;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
public class PlayScreen extends MovieClip
{
public var batArmy:Array;
public var hockArmy:Array;
public var shadow:Shadow;
public var crossHairs:CrossHairs;
var Layer01:MovieClip;
var Layer02:MovieClip;
var Layer03:MovieClip;
var Layer04:MovieClip;
var Layer05:MovieClip;
var randomX:Number = 300 + (660 - 300) * Math.random();
public function PlayScreen()
{
//Mouse.hide();
addBatButton.addEventListener(MouseEvent.CLICK, addBat);
addHockButton.addEventListener(MouseEvent.CLICK, addHock);
batArmy = new Array();
hockArmy = new Array();
//addEventListener(Event.ENTER_FRAME, crossHairsMove);
//stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyPress);
Layer01 = new MovieClip;
this.addChild(Layer01);
Layer02 = new MovieClip;
this.addChild(Layer02);
Layer03 = new MovieClip;
this.addChild(Layer03);
Layer04 = new MovieClip;
this.addChild(Layer04);
Layer05 = new MovieClip;
this.addChild(Layer05);
//add crossHair
/*crossHairs = new CrossHairs(mouseX,mouseY,this);
Layer05.addChild (crossHairs);
addEventListener(Event.ENTER_FRAME, crossHairsMove);*/
}
/*public function onKeyPress(keyboardEvent:KeyboardEvent):void
{
if (keyboardEvent.keyCode == Keyboard.DOWN)
{
trace("yar");
addBat;
}
}*/
public function addBat(mouseEvent:MouseEvent):void
{
var randomX:Number = 300 + (660 - 300) * Math.random();
var newBat = new Bat(randomX, -50, this);
batArmy.push (newBat);
Layer02.addChild (newBat);
}
public function addHock(mouseEvent:MouseEvent):void
{
var newHock = new Hock(-72, 170, this);
hockArmy.push (newHock);
Layer02.addChild (newHock);
}
/*public function crossHairsMove (e:Event):void
{
crossHairs.x = mouseX;
crossHairs.y = mouseY;
}*/
}
とその様子からエラーがホックのクラスとは何かを持っているので、ここではそのためのコードがあります:PlayScreenため
ArgumentError: Error #1063: Argument count mismatch on Hock(). Expected 3, got 0.
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at PlayScreen()[Z:\PROJECTS\Silversound\Occulus Squish\Oculus Squish\Classes\PlayScreen.as:30]
at Main/addPlayscreen()[Z:\PROJECTS\Silversound\Occulus Squish\Oculus Squish\Classes\Main.as:17]
at Main()[Z:\PROJECTS\Silversound\Occulus Squish\Oculus Squish\Classes\Main.as:13]
at runtime::ContentPlayer/loadInitialContent()
at runtime::ContentPlayer/playRawContent()
at runtime::ContentPlayer/playContent()
at runtime::AppRunner/run()
at ADLAppEntry/run()
at global/runtime::ADLEntry()
コードです
import flash.display.MovieClip;
import flash.utils.Timer;
import flash.events.TimerEvent;
import flash.ui.Mouse;
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
import flash.events.Event;
public class Hock extends MovieClip
{
private var _screen: PlayScreen;
public var xSpeed:Number;
public function Hock(startX:Number, startY:Number, screen:PlayScreen)
{
_screen = screen;
x = startX;
y = startY;
width = 100;
scaleY = scaleX;
addEventListener(Event.ENTER_FRAME, moveRightFar);
addEventListener(Event.ENTER_FRAME, moveSpeed)
}
public function moveSpeed(e:Event):void
{
x += xSpeed;
}
public function moveRightFar (e:Event): void
{
if (x < 0)
{
gotoAndStop("rollRight");
xSpeed = 13;
}
else if (x >= 240)
{
gotoAndStop("still")
xSpeed = 0;
}
}
}
今、私が間違っている可能性が、私は0に右ではなく、それは「addHock」機能でvar newHock = new Hock(-72, 170, this);
に問題がいますが、私はそこに3つの引数を持っていると思いますか?とにかく、私が言ったように、それはゲームを走らせ続けるのではないが、それは迷惑なものなので、どんな洞察も歓迎されている。私はそれが明らかなものだと確信しています。ありがとう!