0

ユーザーが移動するセクションを選択できるメニューであるシンプルなフラッシュゲームを作成しています。動詞ボタン (verbal_btn) をクリックすると、動詞セクションに移動します。タイプエラーが発生します

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at elearning2_fla::MainTimeline/playSmall()

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at elearning2_fla::MainTimeline/verbalSmall()

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at elearning2_fla::MainTimeline/frame205()

コードがインスタンスまたはボタンの重複がない右側のフレームの下にすべての名前が付けられています。

stop(); 


physical_btn.buttonMode = true


physical_btn.addEventListener(MouseEvent.CLICK, physicalGame);
function physicalGame(event:MouseEvent): void {
gotoAndPlay(455);

}

physical_btn.addEventListener(MouseEvent.MOUSE_OVER, physicalBig);
function physicalBig(event:MouseEvent): void {
physical_btn.scaleX=1.5;
physical_btn.scaleY=1.5;
}

physical_btn.addEventListener(MouseEvent.MOUSE_OUT, physicalSmall);
function physicalSmall(event:MouseEvent): void {
physical_btn.scaleX=1;
physical_btn.scaleY=1;
}

cyber_btn.buttonMode = true

cyber_btn.addEventListener(MouseEvent.CLICK, cyberGame);
function cyberGame(event:MouseEvent): void {
gotoAndPlay(720);
}

cyber_btn.addEventListener(MouseEvent.MOUSE_OVER, cyberBig);
function cyberBig(event:MouseEvent): void {
cyber_btn.scaleX=1.5;
cyber_btn.scaleY=1.5;
}

cyber_btn.addEventListener(MouseEvent.MOUSE_OUT, cyberSmall);
function cyberSmall(event:MouseEvent): void {
cyber_btn.scaleX=1;
cyber_btn.scaleY=1;
}

verbal_btn.buttonMode = true


verbal_btn.addEventListener(MouseEvent.CLICK, verbalGame);
function verbalGame(event:MouseEvent): void {
gotoAndPlay(190);
}

verbal_btn.addEventListener(MouseEvent.MOUSE_OVER, verbalBig);
function verbalBig(event:MouseEvent): void {
verbal_btn.scaleX=1.5;
verbal_btn.scaleY=1.5;
}

verbal_btn.addEventListener(MouseEvent.MOUSE_OUT, verbalSmall);
function verbalSmall(event:MouseEvent): void {
verbal_btn.scaleX=1;
verbal_btn.scaleY=1;
}

口頭部分の枠に入ったときのコードです。機能する唯一のボタンは情報ボタン (info_btn) です。残りは、クリックしても何もしません。

var mySound5:UHOH = new UHOH();
var mySound4:DING = new DING();


info_mc.addEventListener(MouseEvent.CLICK, verbalInfo);
function verbalInfo(event:MouseEvent): void {
gotoAndPlay(452);
}

info_mc.addEventListener(MouseEvent.MOUSE_OVER, infoBig);
function infoBig(event:MouseEvent): void {
info_mc.scaleX=1.2;
info_mc.scaleY=1.2;
}

info_mc.addEventListener(MouseEvent.MOUSE_OUT, infoSmall);
function infoSmall(event:MouseEvent): void {
info_mc.scaleX=1;
info_mc.scaleY=1;
}

menu_btn.addEventListener(MouseEvent.CLICK, verbalMenu);
function verbalMenu(event:MouseEvent): void {
gotoAndPlay(180);
}

menu_btn.addEventListener(MouseEvent.MOUSE_OVER, bigMenu);
function bigMenu(event:MouseEvent): void {
menu_btn.scaleX=1.1;
menu_btn.scaleY=1.1;
}

menu_btn.addEventListener(MouseEvent.MOUSE_OUT, smallMenu);
function smallMenu(event:MouseEvent): void {
menu_btn.scaleX=1;
menu_btn.scaleY=1;
}


nasty_btn.addEventListener(MouseEvent.CLICK, verbalNasty);
function verbalNasty(event:MouseEvent): void {
mySound4.play();
gotoAndPlay(206);
}

nasty_btn.addEventListener(MouseEvent.MOUSE_OVER, nastyBig);
function nastyBig(event:MouseEvent): void {
nasty_btn.scaleX=1.2;
nasty_btn.scaleY=1.2;
}

nasty_btn.addEventListener(MouseEvent.MOUSE_OUT, nastySmall);
function nastySmall(event:MouseEvent): void {
nasty_btn.scaleX=1.1;
nasty_btn.scaleY=1.1;
}

pretty_btn.addEventListener(MouseEvent.CLICK, verbalPretty);
function verbalPretty(event:MouseEvent): void {
mySound5.play();
}

pretty_btn.addEventListener(MouseEvent.MOUSE_OVER, prettyBig);
function prettyBig(event:MouseEvent): void {
pretty_btn.scaleX=1.2;
pretty_btn.scaleY=1.2;
}

pretty_btn.addEventListener(MouseEvent.MOUSE_OUT, prettySmall);
function prettySmall(event:MouseEvent): void {
pretty_btn.scaleX=1.1;
pretty_btn.scaleY=1.1;
}

nice_btn.addEventListener(MouseEvent.CLICK, verbalNice);
function verbalNice(event:MouseEvent): void {
mySound5.play();
}

nice_btn.addEventListener(MouseEvent.MOUSE_OVER, niceBig);
function niceBig(event:MouseEvent): void {
nice_btn.scaleX=1.2;
nice_btn.scaleY=1.2;
}

nice_btn.addEventListener(MouseEvent.MOUSE_OUT, niceSmall);
function niceSmall(event:MouseEvent): void {
nice_btn.scaleX=1.1;
nice_btn.scaleY=1.1;
}

trace(nice_btn);

stop();

ファイルへのリンクはこちら

ありがとうございました

4

0 に答える 0