错误#1009无法找到导致此null错误的原因

时间:2014-12-13 08:19:42

标签: actionscript-3 flash adobe flash-cs6

我在做作业时遇到了这个问题而且我似乎无法找到解决方法,试图解决这个问题40分钟。

错误

TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at portfolio11_fla::MainTimeline/frame4()
    at flash.display::MovieClip/gotoAndStop()
    at portfolio11_fla::MainTimeline/PW()
TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at portfolio11_fla::MainTimeline/PW()

第4帧上的ActionScript3代码

import flash.events.MouseEvent;

stop();
loginBtn.addEventListener(MouseEvent.CLICK, PW);
function PW(Event:MouseEvent)
{
    if (enterPW.text == "letmein")
    {
        gotoAndStop(4);
    }
    if (enterPW.text == "home")
        {
            gotoAndPlay(1);
        }
    else
    {
        gotoAndPlay(5);
    }
}
Home2.addEventListener(MouseEvent.CLICK, fl_ClickToGoToAndPlayFromFrame_4);

function fl_ClickToGoToAndPlayFromFrame_4(event:MouseEvent):void
{
    gotoAndPlay(1);
}

1 个答案:

答案 0 :(得分:1)

变化:

if (passwordtxtbox.text == "Games")

为:

else if (passwordtxtbox.text == "Games")