Skip to main content
Participant
May 26, 2017
Question

TypeError: Error #2007

  • May 26, 2017
  • 1 reply
  • 969 views

Here's my error

TypeError: Error #2007: Parameter child must be non-null.

    at flash.display::DisplayObjectContainer/addChildAt()

    at fl.controls::BaseButton/drawBackground()

    at fl.controls::BaseButton/draw()

    at fl.core::UIComponent/callLaterDispatcher()

here's my AS

import fl.events.SliderEvent;

import flash.geom.ColorTransform;

import flash.events.Event;

s_red.addEventListener(SliderEvent.THUMB_DRAG,changeColor)

s_green.addEventListener(SliderEvent.THUMB_DRAG,changeColor)

s_blue.addEventListener(SliderEvent.THUMB_DRAG,changeColor)

function changeColor(Event:SliderEvent):void{

    var r= s_red.value;//0- 255

    var red = r.toString(16);//number to hexcode conversion with radix set to 16

    if(red.length<2){red ="o"+red}//if its a single digit number make it double by prefixing ''o''

   

    var g= s_green.value;//0- 255

    var green = g.toString(16);

    if(green.length<2){green ="o"+green}//if its a single digit number make it double by prefixing ''o''

   

    var b= s_blue.value;//0- 255

    var blue = b.toString(16);

    if(blue.length<2){blue ="o"+blue}//if its a single digit number make it double by prefixing ''o''

   

    var myColor:ColorTransform =new ColorTransform();

    myColor.color = uint("ox"+red+green+blue);

    mc.transform.colorTransform = myColor;

    rgb.text = red+green+blue;

}

    myColorfield.addEventListener(Event.CHANGE,changeColor1)

function changeColor1(event:Event):void{

    var myColor1:ColorTransform = new ColorTransform();

    myColor1.color = uint("ox"+myColorfield.text);

    if(myColorfield.length==6){mc.transform.colorTransform = myColor1}

}

Help please

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 26, 2017

click file>publish settings>swf>and tick 'permit debugging'.  retest.

the problematic line number where you're trying to add something that doesn't exist (when your code executes) will be in the error message.  if you still can't fix it after seeing that, copy and paste the problematic line of code.

Participant
May 27, 2017

thank you for replying!

still i get :

TypeError: Error #2007: Parameter child must be non-null.

    at flash.display::DisplayObjectContainer/addChildAt()

    at fl.controls::BaseButton/drawBackground()

    at fl.controls::BaseButton/draw()

    at fl.core::UIComponent/callLaterDispatcher()

that error is appears in output, i dont know why it doesnt work.

the problem is that the drag things are making their work and the rgb text box is working but my (mc) doesnt work and its not changing color when i drag.

kglad
Community Expert
Community Expert
May 27, 2017

again, click file>publish settings>swf>and tick 'permit debugging'.  retest.