我正在尝试从另一个类中的播放器类调用打孔函数,但由于某种原因,它给了我这个错误:
1180: Call to a possibly undefined method Punch.
我不确定为什么它会给我这个错误。我什至公开了这些功能。
这是我从中调用它的类:
package
{
public class Player extends MovieClip
{
public function Player()
{
stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyDown);
stage.addEventListener(KeyboardEvent.KEY_DOWN,KeyPressed);
addEventListener(Event.ENTER_FRAME,Update);
}
function KeyPressed(event:KeyboardEvent):void
{
//If on floor
if (CanJump)
{
//If A key is down
if (event.keyCode == 65)
{
//Punch
Punch(true);
}
}
}
function Update(event:Event)
{
//Do stuff
}
}
}
这就是我要调用的:
package
{
public class ComboSequence extends ComboHandler
{
public function ComboSequence(clipName:String, par:BaseObject, _oList:ObjectList)
{
// constructor code
super(clipName, par, _oList);
}
public function Punch(PunchKey:Boolean)
{
if (currentAttack != null)
{
if (Recovery <= 0 && FollowUpTime > 0)
{
currentAttack = currentAttack.GetNextAttack(PunchKey);
if (currentAttack != null)
{
SetAnimation(currentAttack.animName);
Recovery = currentAttack.Recovery;
FollowUpTime = currentAttack.Recovery + 25;
}
}
}
if (FollowUpTime > 0)
{
FollowUpTime--;
}
else
{
currentAttack = null;
}
if (Recovery > 0)
{
Recovery--;
}
}
}
}