Actionscript 3 错误1120访问未定义的属性

Actionscript 3 错误1120访问未定义的属性,actionscript-3,Actionscript 3,我是动作脚本3的新手,我经常遇到两个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:

我是动作脚本3的新手,我经常遇到两个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);
            }
        }
    }
}
}
public函数Main()
{
hillPage=新的hillPage();
水池=新水池();
起始页=新起始页();
addChild(pondPage);
startPage.hillButton.addEventListener(MouseEvent.CLICK,onHillButtonClick);
startPage.pondButton.addEventListener(MouseEvent.CLICK,onPondButtonClick);
hillPage.backToStartButton.addEventListener(MouseEvent.CLICK,在BackButtonClick_Hill上);
pondPage.backToStartButton.addEventListener(MouseEvent.CLICK,onBackButtonClick_Pond);
hillPage.upButton.addEventListener(MouseEvent.CLICK,onUpButtonClick);
hillPage.downButton.addEventListener(MouseEvent.CLICK,onDownButton单击);
hillPage.growButton.addEventListener(MouseEvent.CLICK,ongrowButton单击);
hillPage.shrinkButton.addEventListener(MouseEvent.CLICK,onShrinkButton单击);
hillPage.visibilityButton.addEventListener(MouseEvent.CLICK,on visibilityButton单击);
hillPage.lookButton.addEventListener(MouseEvent.CLICK,onLookButtonClick);
hillPage.leftButton.addEventListener(MouseEvent.CLICK,onLeftButtonClick);
hillPage.rightButton.addEventListener(MouseEvent.CLICK,onRightButton单击);
pondPage.frog.addEventListener(MouseEvent.MOUSE_OVER,onFrogMouseOver);
pondPage.frog.addEventListener(MouseEvent.CLICK,onFrogClick);
函数onHillButtonClick(事件:MouseEvent):void
{
addChild(hillPage);
removeChild(起始页);
}
函数onPondButtonClick(事件:MouseEvent):void
{
addChild(pondPage);
removeChild(起始页);
}
函数onBackButtonClick_Hill(事件:MouseEvent):void
{
addChild(起始页);
removeChild(山丘);
}
函数onBackButtonClick_Pond(事件:MouseEvent):void
{
addChild(起始页);
清除积水;
}
函数onUpButtonClick(事件:MouseEvent):void
{
山丘类别y-=15;
if(山丘类别y<90)
{
山丘类型y=90;
}
迹线(山丘,y类);
}
函数onDownButtonClick(事件:MouseeEvent):无效
{
山丘类别y+=15;
if(山丘类别y>238)
{
山丘类型y=238;
}
迹线(山丘,y类);
}
函数onGrowButtonClick(事件:MouseEvent):void
{
hillPage.cat.scaleX+=0.1;
hillPage.cat.scaleY+=0.1;
}
收缩按钮上的函数单击(事件:MouseEvent):无效
{
hillPage.cat.scaleX-=0.1;
hillPage.cat.scaleY-=0.1;
}
函数onVisibilityButton单击(事件:MouseeEvent):无效
{
hillPage.cat.visible=!hillPage.cat.visible;
}
函数onLookButtonClick(事件:MouseEvent):void
{
hillPage.cat.leftEye.rotation+=20;
hillPage.cat.rightEye.rotation+=20;
}
函数onLeftButtonClick(事件:MouseEvent):void
{
如果(hillPage.cat.x>=240)
{
山丘类别x-=15;
}
}
函数onRightButtonClick(事件:MouseEvent):void
{

如果(hillPage.cat.x您的方法
onFrogMouseOver
onFrogClick
嵌套在
onrightbutonclick

将它们移出
onright按钮单击
块:

function onRightButtonClick(event:MouseEvent):void
{
    if(hillPage.cat.x <= 487)
    {
        hillPage.cat.x +=  15;
    }

    // They were previously defined here.
    // Removed and put below.
}

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);
}
右键上的函数单击(事件:MouseEvent):无效 { if(hillPage.cat.x