シンプルなメモリーゲームを作成しようとしていますが、イントロ、メインゲーム、エンドの 3 つのフレームがありますが、「開始ボタン」をクリックしてフレーム 2 にジャンプするたびに、このエラーが発生し続けます。
TypeError: Error #1006: Play_AnimalCardGame is not a function.
at AnimalCardGame/frame2()
at flash.display::MovieClip/gotoAndStop()
at AnimalCardGame/startGame()
私の.AS
package{
import flash.display.*;
import flash.events.*;
import flash.utils.getTimer;
public class Play_AnimalCardGame extends MovieClip
{
private static const boardWidth:uint =4;
private static const boardHeight:uint =3;
private static const cardVSpace:Number=100;
private static const cardHSpace:Number=15;
private static const offSetX:Number=115;
private static const offSetY:Number=155;
public function Play_AnimalCardGame ():void
{
var cardDeck:Array = new Array();
for ( var i:uint=0;i<boardWidth*boardHeight/2;i++){
cardDeck.push(i);
cardDeck.push(i);
}
for(var x:uint=0; x<boardWidth ; x++){
for(var y:uint=0; y<boardHeight;y++){
var aCard:Card = new Card();
aCard.stop();
aCard.x = x*offSetX+cardVSpace;
aCard.y = y*offSetY+cardHSpace;
var randomCard:uint = Math.floor(Math.random()*cardDeck.length);
aCard.cardface= cardDeck[randomCard];
cardDeck.splice(randomCard,1);
aCard.gotoAndStop(1);
aCard.addEventListener(MouseEvent.CLICK,clickCard);
addChild(aCard);
cardLeft++;
}
}
}
private var firstPick:Card;
private var secondPick:Card;
private var cardLeft;
private static const pointHit:int =100;
private static const pointMiss:int = -5;
private var startscore =0;
var startTime:uint;
var time:uint;
public function clickCard(event:MouseEvent){
var pickedCard:Card = (event.currentTarget as Card);
if(firstPick == null){
firstPick =pickedCard;
firstPick.gotoAndStop(pickedCard.cardface+2);
}
else if (firstPick ==pickedCard){
firstPick.gotoAndStop(1);
firstPick=null;
}
else if (secondPick ==null){
secondPick= pickedCard;
secondPick.gotoAndStop(pickedCard.cardface+2);
if (firstPick.cardface == secondPick.cardface){
startscore +=pointHit;
cardLeft-=2;
removeChild(firstPick);
removeChild(secondPick);
txtscore.text= String(startscore);
firstPick = null;
secondPick=null;
}
else{
firstPick.gotoAndStop(1);
secondPick.gotoAndStop(1);
startscore +=pointMiss;
txtscore.text= String(startscore);
secondPick=null;
firstPick = pickedCard;
firstPick.gotoAndStop(pickedCard.cardface+2);
}
}
if(cardLeft==0){
gotoAndStop("gameover");
}
}
public function showTimer(event:Event)
{
startTime = getTimer();
time=0;
time = getTimer()- startTime;
txtTime.text = clockTime(time);
}
public function clockTime(ms:int){
var seconds:int = Math.floor(ms/1000);
var minutes:int = Math.floor(seconds/60);
seconds -=minutes *60;
var timeString:String = minutes+":"+String(seconds+100).substr(1,2);
return timeString;
}
}
私ができることから問題はありませんが、それでもまだ学習のみです