Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

TypeError: Error #2007

Explorer ,
Dec 13, 2014 Dec 13, 2014

Hello Everybody,

I created a contact form in my new flash website and it was working fine in a test file but now I get this message.

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/drawNow()

  at fl.controls::ScrollBar/draw()

  at fl.controls::UIScrollBar/draw()

  at fl.core::UIComponent/drawNow()

  at fl.controls::TextArea/updateScrollBars()

  at fl.controls::TextArea/drawLayout()

  at fl.controls::TextArea/draw()

  at fl.core::UIComponent/callLaterDispatcher()

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/drawNow()

  at fl.controls::ScrollBar/draw()

  at fl.controls::UIScrollBar/draw()

  at fl.core::UIComponent/callLaterDispatcher()

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()

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

  at flash.display::DisplayObjectContainer/addChildAt()

  at fl.controls::BaseButton/drawBackground()

  at fl.controls::LabelButton/draw()

  at fl.core::UIComponent/callLaterDispatcher()

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()

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()

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/drawNow()

  at fl.controls::ScrollBar/draw()

  at fl.controls::UIScrollBar/draw()

  at fl.core::UIComponent/callLaterDispatcher()

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()

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

  at flash.display::DisplayObjectContainer/addChildAt()

  at fl.controls::BaseButton/drawBackground()

  at fl.controls::LabelButton/draw()

  at fl.core::UIComponent/callLaterDispatcher()

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()

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()

Any help would be great.

Thank you

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2014 Dec 13, 2014

it looks like you're using components in your code and may need to delay execution of that code for fraction of a second.  usually, one enterframe loop gives enough time for the components to initialize.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2014 Dec 13, 2014

How would I change the code to do that?

Here is my AS:

submit_btn.addEventListener(MouseEvent.CLICK, sendMessage);

function sendMessage(e:MouseEvent):void{

var my_vars:URLVariables = new URLVariables();

my_vars.senderName = name_txt.text;

my_vars.senderEmail = email_txt.text;

my_vars.senderMsg = message_txt.text;

var my_url:URLRequest = new URLRequest("mail.php");

my_url.method = URLRequestMethod.POST;

my_url.data = my_vars;

var my_loader:URLLoader = new URLLoader();

my_loader.dataFormat = URLLoaderDataFormat.VARIABLES;

my_loader.load(my_url);

name_txt.text = "";

email_txt.text = "";

message_txt.text = "Message Sent";

}

and here is the php:

<?php

$to = "myemail@Here";

$subject = ($_POST['senderName']);

$message = ($_POST['senderMsg']);

$message .= "\n\n---------------------------\n";

$message .= "E-mail Sent From: " . $_POST['senderName'] . " <" . $_POST['senderEmail'] . ">\n";

$headers = "From: " . $_POST['senderName'] . " <" . $_POST['senderEmail'] . ">\n";

if(@mail($to, $subject, $message, $headers))

{

echo "answer=ok";

}

else

{

echo "answer=error";

}

?>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2014 Dec 13, 2014
this.addEventListener(Event.ENTER_FRAME,f);

function f(e:Event):void{

submit_btn.addEventListener(MouseEvent.CLICK, sendMessage);

this.removeEventListener(Event.ENTER_FRAME,f);

}

function sendMessage(e:MouseEvent):void{

var my_vars:URLVariables = new URLVariables();

my_vars.senderName = name_txt.text;

my_vars.senderEmail = email_txt.text;

my_vars.senderMsg = message_txt.text;

var my_url:URLRequest = new URLRequest("mail.php");

my_url.method = URLRequestMethod.POST;

my_url.data = my_vars;

var my_loader:URLLoader = new URLLoader();

my_loader.dataFormat = URLLoaderDataFormat.VARIABLES;

my_loader.load(my_url);

name_txt.text = "";

email_txt.text = "";

message_txt.text = "Message Sent";

}

and here is the php:

<?php

$to = "myemail@Here";

$subject = ($_POST['senderName']);

$message = ($_POST['senderMsg']);

$message .= "\n\n---------------------------\n";

$message .= "E-mail Sent From: " . $_POST['senderName'] . " <" . $_POST['senderEmail'] . ">\n";

$headers = "From: " . $_POST['senderName'] . " <" . $_POST['senderEmail'] . ">\n";

if(@mail($to, $subject, $message, $headers))

{

echo "answer=ok";

}

else

{

echo "answer=error";

}

?>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 13, 2014 Dec 13, 2014

I copy and pasted the code but I still get the same message.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 13, 2014 Dec 13, 2014

create a new fla.

draw a shape on stage>right click it>click convert to symbol>movieclip>ok>assign the instance name, submit_btn in the properties panel while that movieclip is still selected.

open the actions panel and paste your actionscript from message 2 into that panel.

test.

any problem?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 14, 2014 Dec 14, 2014

It tells the person typing that the message was sent but it never shows up in my inbox. Also, I could click the submit button and it says message sent without having typed anything in the fields.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 15, 2014 Dec 15, 2014
LATEST

i can't tell why it's not in your inbox.  that testing needs to be done on your server.

and you don't have any code that prevents sending an empty email.  a few if-statements to check that in sendMessage() would work.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines