0
我是新來的操作腳本3,我不斷收到兩個1120錯誤。一個錯誤的是錯誤1120訪問未定義的屬性
C:\Users\Server\Desktop\New folder\InteractiveStoryBook\Main.as, Line 31 1120: Access of undefined property onFrogMouseOver
和其他錯誤是
C:\Users\Server\Desktop\New folder\InteractiveStoryBook\Main.as, Line 32 1120: Access of undefined property onFrogClick.
我正確添加我的所有情況,但我仍然得到錯誤。 這是在該地區的代碼中的錯誤是:
之前public function Main()
{
hillPage = new HillPage();
pondPage = new PondPage();
startPage = new StartPage();
addChild(pondPage);
startPage.hillButton.addEventListener(MouseEvent.CLICK, onHillButtonClick);
startPage.pondButton.addEventListener(MouseEvent.CLICK, onPondButtonClick);
hillPage.backToStartButton.addEventListener(MouseEvent.CLICK, onBackButtonClick_Hill);
pondPage.backToStartButton.addEventListener(MouseEvent.CLICK, onBackButtonClick_Pond);
hillPage.upButton.addEventListener(MouseEvent.CLICK, onUpButtonClick);
hillPage.downButton.addEventListener(MouseEvent.CLICK, onDownButtonClick);
hillPage.growButton.addEventListener(MouseEvent.CLICK, onGrowButtonClick);
hillPage.shrinkButton.addEventListener(MouseEvent.CLICK, onShrinkButtonClick);
hillPage.visibilityButton.addEventListener(MouseEvent.CLICK, onVisibilityButtonClick);
hillPage.lookButton.addEventListener(MouseEvent.CLICK, onLookButtonClick);
hillPage.leftButton.addEventListener(MouseEvent.CLICK, onLeftButtonClick);
hillPage.rightButton.addEventListener(MouseEvent.CLICK, onRightButtonClick);
pondPage.frog.addEventListener(MouseEvent.MOUSE_OVER, onFrogMouseOver);
pondPage.frog.addEventListener(MouseEvent.CLICK, onFrogClick);
function onHillButtonClick(event:MouseEvent):void
{
addChild(hillPage);
removeChild(startPage);
}
function onPondButtonClick(event:MouseEvent):void
{
addChild(pondPage);
removeChild(startPage);
}
function onBackButtonClick_Hill(event:MouseEvent):void
{
addChild(startPage);
removeChild(hillPage);
}
function onBackButtonClick_Pond(event:MouseEvent):void
{
addChild(startPage);
removeChild(pondPage);
}
function onUpButtonClick(event:MouseEvent):void
{
hillPage.cat.y -= 15;
if (hillPage.cat.y < 90)
{
hillPage.cat.y = 90;
}
trace(hillPage.cat.y);
}
function onDownButtonClick(event:MouseEvent):void
{
hillPage.cat.y += 15;
if (hillPage.cat.y > 238)
{
hillPage.cat.y = 238;
}
trace(hillPage.cat.y);
}
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;
}
function onVisibilityButtonClick(event:MouseEvent):void
{
hillPage.cat.visible = ! hillPage.cat.visible;
}
function onLookButtonClick(event:MouseEvent):void
{
hillPage.cat.leftEye.rotation += 20;
hillPage.cat.rightEye.rotation += 20;
}
function onLeftButtonClick(event:MouseEvent):void
{
if (hillPage.cat.x >= 240)
{
hillPage.cat.x -= 15;
}
}
function onRightButtonClick(event:MouseEvent):void
{
if (hillPage.cat.x <= 487)
{
hillPage.cat.x += 15;
}
function onFrogMouseOver(event:MouseEvent):void
{
pondPage.frog.goToAndStop(2);
pondPage.frog.removeEventListener(MouseEvent.MOUSE_OVER, onFrogMouseOver);
}
function onFrogClick(event:MouseEvent):void
{
pondPage.frog.goToAndStop(3);
pondPage.frog.removeEventListener(MouseEvent.CLICK, onFrogClick);
}
}
}
}
}
一切都只是變量和擴展影片剪輯和所有其他的東西。謝謝!
謝謝你這麼多的程序現在工作:) – user2426867