拡大ボタンと縮小ボタンのコードを追加した後、コードに問題が発生しました。それは私に言っている
「C:\Users\Dan\Desktop\Flash\Interactive Story Book\Main.as、Line 28 1120: 未定義のプロパティ onShrinkButtonClick へのアクセス。」
"C:\Users\Dan\Desktop\Flash\Interactive Story Book\Main.as, Line 29 1120: 未定義のプロパティ onGrowButtonClick へのアクセス。
インスタンス名は正しく、AsLinkage またはオブジェクト名と同じではありません。
package
{
import flash.display.MovieClip;
import flash.events.MouseEvent;
public class Main extends MovieClip
{
var startPage:StartPage;
var hillPage:HillPage;
var lakePage:LakePage;
public function Main()
{
startPage = new StartPage();
hillPage = new HillPage();
lakePage = new LakePage();
addChild(hillPage);
//Add event listeners
startPage.buttonHill.addEventListener(MouseEvent.CLICK, onHillButtonClick);
startPage.buttonLake.addEventListener(MouseEvent.CLICK, onLakeButtonClick);
hillPage.btsButton.addEventListener(MouseEvent.CLICK, onStartButtonClick_hill);
lakePage.btsButton.addEventListener(MouseEvent.CLICK, onStartButtonClick_lake);
hillPage.upButton.addEventListener(MouseEvent.CLICK, onUpButtonClick);
hillPage.downButton.addEventListener(MouseEvent.CLICK, onDownButtonClick);
hillPage.shrinkButton.addEventListener(MouseEvent.CLICK, onShrinkButtonClick);
hillPage.growButton.addEventListener(MouseEvent.CLICK, onGrowButtonClick);
}
//Event handlers
function onHillButtonClick(event:MouseEvent):void
{
addChild(hillPage);
removeChild(startPage);
}
function onLakeButtonClick(event:MouseEvent):void
{
addChild(lakePage);
removeChild(startPage);
}
function onStartButtonClick_hill(event:MouseEvent):void
{
addChild(startPage);
removeChild(hillPage);
}
function onStartButtonClick_lake(event:MouseEvent):void
{
addChild(startPage);
removeChild(lakePage);
}
function onUpButtonClick(event:MouseEvent):void
{
hillPage.cat.y -=15
if(hillPage.cat.y < 90)
{
hillPage.cat.y =90
}
}
function onDownButtonClick(event:MouseEvent):void
{
hillPage.cat.y +=15
if(hillPage.cat.y >190)
{
hillPage.cat.y =190
}
function onGrowButtonClick(event:MouseEvent):void
{
hillPage.cat.scaleX +=0.1;
hillPage.cat.scaleY +=0.1;
}
function onShrinkButtonClick(event:MouseEvent):void
{
hillPage.cat.scaleX -=0.1;
hillPage.cat.scaleY -=0.1;
}
}
}
}