首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >TypeError:错误#1009:无法访问空对象引用的属性或方法。在RECOVER_fyp1_fla::MainTimeline/abc1()

TypeError:错误#1009:无法访问空对象引用的属性或方法。在RECOVER_fyp1_fla::MainTimeline/abc1()
EN

Stack Overflow用户
提问于 2013-08-02 02:54:56
回答 1查看 55关注 0票数 0

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

嗨,这是什么意思?有没有人能弄明白?谢谢。

代码:

代码语言:javascript
运行
复制
swatter.addEventListener(Event.ENTER_FRAME,abc1);

Mouse.hide();



function abc1(e:Event)
{
    swatter.x = mouseX;
    swatter.y = mouseY;

    enter code here

    mosq1.y = mosq1.y + 2;
    mosq2.y = mosq2.y + 3;
    mosq3.y = mosq3.y + 4;
    mosq4.y = mosq4.y + 5;
    mosq5.y = mosq5.y + 6;



    if (mosq1.y > 640)
    {
        mosq1.y = -50;
    }

    if (mosq2.y > 640)
    {
        mosq2.y = -50;
    }

    if (mosq3.y > 640)
    {
        mosq3.y = -50;
    }

    if (mosq4.y > 640)
    {
        mosq4.y = -50;
    }

    if (mosq5.y > 640)
    {
        mosq5.y = -50;
    }


    if(swatter.hitTestObject(mosq1))
    {
        //SoundMixer.stopAll();
        //three_start_sound1.play();
        mosq1.parent.removeChild(mosq1);
    }

    if(swatter.hitTestObject(mosq2))
    {
        //SoundMixer.stopAll();
        //three_start_sound1.play();
        mosq2.parent.removeChild(mosq2);
    }

    if(swatter.hitTestObject(mosq3))
    {
        //SoundMixer.stopAll();
        //three_start_sound1.play();
        mosq3.parent.removeChild(mosq3);
    }

    if(swatter.hitTestObject(mosq4))
    {
        //SoundMixer.stopAll();
        //three_start_sound1.play();
        mosq4.parent.removeChild(mosq4);
    }

    if(swatter.hitTestObject(mosq5))
    {
        //SoundMixer.stopAll();
        //three_start_sound1.play();
        mosq5.parent.removeChild(mosq5);
    }
}

enter code here
EN

回答 1

Stack Overflow用户

发布于 2013-08-02 23:33:02

但是这些变量:

代码语言:javascript
运行
复制
mosq1.y = mosq1.y + 2;
mosq2.y = mosq2.y + 3;
mosq3.y = mosq3.y + 4;
mosq4.y = mosq4.y + 5;
mosq5.y = mosq5.y + 6;

都实例化了??这些都是空的。

错误代码很清楚,您正在尝试使用空对象的属性

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18002255

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档