错误#2007:参数孩子必须为非空 [英] Error #2007: Parameter child must be non-null

查看:182
本文介绍了错误#2007:参数孩子必须为非空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有什么错误,但今天!这将是很好的sooo得到一点帮助,这一个。

我调用外部子SWF为AIR应用程序;超级简单 - 称他们有一个按钮,并配有家的按钮,清除他们,仅此而已。但我得到这些错误,我不能公布,甚至一个测试,而不使整个系统崩溃。请帮忙!我一直坚持这一点,从字面上看,几个星期!

这是错误:

 类型错误:错误#2007:参数孩子必须为非空。
在flash.display使用::级DisplayObjectContainer / removeChild之()
在pocketDinos_fla :: MainTimeline / fl_ClickToGoToAndStopAtFrame_20_1()
[pocketDinos_fla.MainTimeline :: frame162:18]
测试影片结束。
 

这就是我认为是造成主时间轴上的问题(这是所有主时间轴上的code):

 停止();

// home键

button_home.addEventListener(MouseEvent.CLICK,fl_ClickToLoadUnloadSWF_01_1,假,0,真正的);

功能fl_ClickToLoadUnloadSWF_01_1(事件:MouseEvent)方法:无效
{
removeChild之(fl_ProLoader_01);
fl_ProLoader_01.unloadAndStop();
fl_ProLoader_01 = NULL;
}

button_home.addEventListener(MouseEvent.CLICK,
fl_ClickToGoToAndStopAtFrame_01_1,假,0,真正的);

功能fl_ClickToGoToAndStopAtFrame_01_1(事件:MouseEvent)方法:无效
{
removeChild之(fl_ProLoader_01);

}
button_home.addEventListener(MouseEvent.CLICK,fl_ClickToStopAllSounds_01_1,假,0,真正的);

功能fl_ClickToStopAllSounds_01_1(事件:MouseEvent)方法:无效
{
SoundMixer.stopAll();
}

button_home.addEventListener(MouseEvent.CLICK,
fl_ClickToGoToAndStopAtFrame_01_2,假,0,真正的);

功能fl_ClickToGoToAndStopAtFrame_01_2(事件:MouseEvent)方法:无效
{
gotoAndStop(家);
}

//返回时间段按钮

back_to_triassic.addEventListener(MouseEvent.CLICK,
fl_ClickToLoadUnloadSWF_01_2,假,0,真正的);

功能fl_ClickToLoadUnloadSWF_01_2(事件:MouseEvent)方法:无效
{
removeChild之(fl_ProLoader_01);
fl_ProLoader_01.unloadAndStop();
fl_ProLoader_01 = NULL;
}

back_to_triassic.addEventListener(MouseEvent.CLICK,
fl_ClickToGoToAndStopAtFrame_01_3,假,0,真正的);

功能fl_ClickToGoToAndStopAtFrame_01_3(事件:MouseEvent)方法:无效
{
removeChild之(fl_ProLoader_01);

}
back_to_triassic.addEventListener(MouseEvent.CLICK,
fl_ClickToStopAllSounds_01_2,假,0,真正的);

功能fl_ClickToStopAllSounds_01_2(事件:MouseEvent)方法:无效
{
SoundMixer.stopAll();
}

back_to_triassic.addEventListener(MouseEvent.CLICK,
fl_ClickToGoToAndStopAtFrame_01_4,假,0,真正的);

功能fl_ClickToGoToAndStopAtFrame_01_4(事件:MouseEvent)方法:无效
{
gotoAndStop(TRI_home);
}


//启动按钮

start_button_TRI_coelophysis.addEventListener(MouseEvent.CLICK,
fl_ClickToLoadUnloadSWF_01_3,假,0,真正的);

进口fl.display.ProLoader;
进口对象类型:flash.events.Event;

VAR fl_ProLoader_01:ProLoader;

功能fl_ClickToLoadUnloadSWF_01_3(事件:MouseEvent)方法:无效
{
如果(fl_ToLoad_01)
{
    fl_ProLoader_01 =新ProLoader();
    fl_ProLoader_01.load(新的URLRequest(dinofilms / triassic_coelophysis.swf));

fl_ProLoader_01.contentLoaderInfo.addEventListener(引发Event.COMPLETE,onComplete_01)
    的addChild(fl_ProLoader_01);
    fl_ProLoader_01.x = 0;
    fl_ProLoader_01.y = 144;
}
其他
{
    如果(fl_ProLoader_01!= NULL){
        removeChild之(fl_ProLoader_01);
        fl_ProLoader_01.unloadAndStop();
        fl_ProLoader_01 = NULL;
    }
}
fl_ToLoad_01 = fl_ToLoad_01!;

}

功能onComplete_01(五:事件):无效{
e.currentTarget.content.addEventListener(Event.ENTER_FRAME,OEF_01);
}

功能OEF_01(五:事件):无效{
如果(e.currentTarget.currentFrame == e.currentTarget.totalFrames){
    e.currentTarget.stop();
    e.currentTarget.removeEventListener(Event.ENTER_FRAME,OEF_01);

    removeChild之(fl_ProLoader_01);
    fl_ProLoader_01.unloadAndStop();
    fl_ProLoader_01 = NULL;
}
}
 

解决方案

我觉得它得到了解决!

 停止();

// home键

button_home.addEventListener(MouseEvent.CLICK,
fl_ClickToGoToAndStopAtFrame_01_1,假,0,真正的);
功能fl_ClickToGoToAndStopAtFrame_01_1(事件:MouseEvent)方法:无效
{
如果(fl_ProLoader_01&安培;&安培; fl_ProLoader_01.stage){
 fl_ProLoader_01.parent.removeChild(fl_ProLoader_01);}
 gotoAndStop(家);
 }


button_home.addEventListener(MouseEvent.CLICK,fl_ClickToStopAllSounds_01_1,假,0,真正的);
功能fl_ClickToStopAllSounds_01_1(事件:MouseEvent)方法:无效
{
SoundMixer.stopAll();
}



//返回时间段按钮


back_to_triassic.addEventListener(MouseEvent.CLICK,
fl_ClickToGoToAndStopAtFrame_01_3,假,0,真正的);
功能fl_ClickToGoToAndStopAtFrame_01_3(事件:MouseEvent)方法:无效
{
如果(fl_ProLoader_01&安培;&安培; fl_ProLoader_01.stage){
 fl_ProLoader_01.parent.removeChild(fl_ProLoader_01);}
 gotoAndStop(TRI_home);
 }

back_to_triassic.addEventListener(MouseEvent.CLICK,
fl_ClickToStopAllSounds_01_2,假,0,真正的);
功能fl_ClickToStopAllSounds_01_2(事件:MouseEvent)方法:无效
{
SoundMixer.stopAll();
}
 

不过,我还是我有孩子文件没有加载设备本身的问题 - 奇怪 - 他们加载罚款测试的出口,而不是当我发布到设备(在这种情况下,IOS)。有没有人有什么想法?

Having nothing but errors today! It would be sooo nice to get a bit of help with this one.

I am calling external child swfs for an AIR app; SUPER SIMPLE - calling them with a button, and removing them with a "home" button, that's it. But I get these errors and I cannot publish, even a test, without crashing the entire system. Please help! I have been stuck on this, literally, for weeks!

this is the error:

TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at pocketDinos_fla::MainTimeline/fl_ClickToGoToAndStopAtFrame_20_1()  
[pocketDinos_fla.MainTimeline::frame162:18]
Test Movie terminated.

And this is what I assume is causing the problem on the main timeline (this is ALL the code on the main timeline):

 stop();

//home button

button_home.addEventListener(MouseEvent.CLICK, fl_ClickToLoadUnloadSWF_01_1,false,0,true);

function fl_ClickToLoadUnloadSWF_01_1(event:MouseEvent):void
{
removeChild(fl_ProLoader_01);
fl_ProLoader_01.unloadAndStop();
fl_ProLoader_01 = null;
}

button_home.addEventListener(MouseEvent.CLICK,     
fl_ClickToGoToAndStopAtFrame_01_1,false,0,true);

function fl_ClickToGoToAndStopAtFrame_01_1(event:MouseEvent):void
{
removeChild(fl_ProLoader_01);

}
button_home.addEventListener(MouseEvent.CLICK, fl_ClickToStopAllSounds_01_1,false,0,true);

function fl_ClickToStopAllSounds_01_1(event:MouseEvent):void
{
SoundMixer.stopAll();
}

button_home.addEventListener(MouseEvent.CLICK,     
fl_ClickToGoToAndStopAtFrame_01_2,false,0,true);

function fl_ClickToGoToAndStopAtFrame_01_2(event:MouseEvent):void
{
gotoAndStop("home");
}

//back to time period button

back_to_triassic.addEventListener(MouseEvent.CLICK,    
fl_ClickToLoadUnloadSWF_01_2,false,0,true);

function fl_ClickToLoadUnloadSWF_01_2(event:MouseEvent):void
{
removeChild(fl_ProLoader_01);
fl_ProLoader_01.unloadAndStop();
fl_ProLoader_01 = null;
}

back_to_triassic.addEventListener(MouseEvent.CLICK,   
fl_ClickToGoToAndStopAtFrame_01_3,false,0,true);

function fl_ClickToGoToAndStopAtFrame_01_3(event:MouseEvent):void
{
removeChild(fl_ProLoader_01);

}
back_to_triassic.addEventListener(MouseEvent.CLICK,    
fl_ClickToStopAllSounds_01_2,false,0,true);

function fl_ClickToStopAllSounds_01_2(event:MouseEvent):void
{
SoundMixer.stopAll();
}

back_to_triassic.addEventListener(MouseEvent.CLICK,    
fl_ClickToGoToAndStopAtFrame_01_4,false,0,true);

function fl_ClickToGoToAndStopAtFrame_01_4(event:MouseEvent):void
{
gotoAndStop("TRI_home");
}


//start button

start_button_TRI_coelophysis.addEventListener(MouseEvent.CLICK,   
fl_ClickToLoadUnloadSWF_01_3,false,0,true);

import fl.display.ProLoader;
import flash.events.Event;

var fl_ProLoader_01:ProLoader;

function fl_ClickToLoadUnloadSWF_01_3(event:MouseEvent):void
{
if(fl_ToLoad_01)
{
    fl_ProLoader_01 = new ProLoader();
    fl_ProLoader_01.load(new URLRequest("dinofilms/triassic_coelophysis.swf"));

fl_ProLoader_01.contentLoaderInfo.addEventListener(Event.COMPLETE,onComplete_01)
    addChild(fl_ProLoader_01);
    fl_ProLoader_01.x = 0;
    fl_ProLoader_01.y = 144;
}
else
{
    if(fl_ProLoader_01!=null) {
        removeChild(fl_ProLoader_01);
        fl_ProLoader_01.unloadAndStop();
        fl_ProLoader_01 = null;
    }
}
fl_ToLoad_01 = !fl_ToLoad_01;

}

function onComplete_01(e:Event):void {
e.currentTarget.content.addEventListener(Event.ENTER_FRAME,OEF_01);
}

function OEF_01(e:Event):void {
if(e.currentTarget.currentFrame==e.currentTarget.totalFrames) {
    e.currentTarget.stop();
    e.currentTarget.removeEventListener(Event.ENTER_FRAME,OEF_01);

    removeChild(fl_ProLoader_01);
    fl_ProLoader_01.unloadAndStop();
    fl_ProLoader_01 = null;
}
}

解决方案

I think it got solved!

stop();

//home button

button_home.addEventListener(MouseEvent.CLICK,     
fl_ClickToGoToAndStopAtFrame_01_1,false,0,true);
function fl_ClickToGoToAndStopAtFrame_01_1(event:MouseEvent):void
{
if(fl_ProLoader_01 && fl_ProLoader_01.stage){ 
 fl_ProLoader_01.parent.removeChild(fl_ProLoader_01);}
 gotoAndStop("home");
 }


button_home.addEventListener(MouseEvent.CLICK, fl_ClickToStopAllSounds_01_1,false,0,true);
function fl_ClickToStopAllSounds_01_1(event:MouseEvent):void
{
SoundMixer.stopAll();
}



//back to time period button


back_to_triassic.addEventListener(MouseEvent.CLICK,     
fl_ClickToGoToAndStopAtFrame_01_3,false,0,true);
function fl_ClickToGoToAndStopAtFrame_01_3(event:MouseEvent):void
{
if(fl_ProLoader_01 && fl_ProLoader_01.stage){ 
 fl_ProLoader_01.parent.removeChild(fl_ProLoader_01);}
 gotoAndStop("TRI_home");
 }

back_to_triassic.addEventListener(MouseEvent.CLICK,     
fl_ClickToStopAllSounds_01_2,false,0,true);
function fl_ClickToStopAllSounds_01_2(event:MouseEvent):void
{
SoundMixer.stopAll();
}

However, I still am having the problem that the child files are not loading on the device itself - strange - they load fine on "test" export, but not when I publish to device (in this case ios). Does anyone have any ideas?

这篇关于错误#2007:参数孩子必须为非空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆