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

as3 TypeError:#2007 Parameter text must be non-null can't fix.

New Here ,
Feb 20, 2014 Feb 20, 2014

I have comment box project. As3+php based project.And have #2007 Error.Try to fix but can't do anything.If can help it would be very helpful.Error part like this:

TypeError: Error #2007: Parameter text must be non-null. at flash.text::TextField/set text() at comment2_fla::mc_1/completeHandler() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at flash.net::URLLoader/onComplete()

First Part of Code:

var variables_re:URLVariables = new URLVariables();

var varSend_re:URLRequest = new URLRequest("guestbookParse.php");

varSend_re.method = URLRequestMethod.POST;

varSend_re.data = variables_re;

var varLoader_re:URLLoader = new URLLoader;

varLoader_re.dataFormat = URLLoaderDataFormat.VARIABLES;

varLoader_re.addEventListener(Event.COMPLETE,completeHandler_re);

function completeHandler_re(event:Event):void{

          if(event.target.data.returnBody==""){

             gbOutput_txt.text = "no data";

             } else {

                       gbOutput_txt.condenseWhite = true;

                       gbOutput_txt.htmlText = "" + event.target.data.returnBody;

                      

             }

}

variables_re.comType = "requestEntries";

varLoader_re.load(varSend_re);

Second Part of Code:

msg_txt.restrict = "ığüşöç A-Za-z 0-9";

name_txt.restrict = "ığüşöç A-Za-z 0-9";

var errorsFormat:TextFormat = new TextFormat();

errorsFormat.color = 0XFF0000;

processing_mc.visible = false;

var variables:URLVariables = new URLVariables();

var varSend:URLRequest = new URLRequest("guestbookParse.php");

varSend.method = URLRequestMethod.POST;

varSend.data = variables;

var varLoader:URLLoader = new URLLoader;

varLoader.dataFormat = URLLoaderDataFormat.VARIABLES;

varLoader.addEventListener(Event.COMPLETE,completeHandler);

function completeHandler(event:Event):void{

          processing_mc.visible = false;

          name_txt.text = "";

          msg_txt.text = "";

          status_txt.text = event.target.data.return_msg;

          gbOutput_txt.condenseWhite = true;

          gbOutput_txt.htmlText=""+event.target.data.returnBody;

 

 

 

}

submit_btn.addEventListener(MouseEvent.CLICK,ValidateAndSend);

function ValidateAndSend(event:MouseEvent):void{

 

          if(!name_txt.length){

                    status_txt.text = "İsminizi Girin";

                    status_txt.setTextFormat(errorsFormat);

          } else if (!msg_txt.length){

                    status_txt.text = "Yorum Girin";

                    status_txt.setTextFormat(errorsFormat);

          }else{

                    processing_mc.visible = true;

 

                    variables.comType = "parseComment";

                    variables.userName = name_txt.text;

                    variables.userMsg = msg_txt.text;

 

                    varLoader.load(varSend);

                    status_txt.text = "Yorumunuz Eklendi...";

          }

}

Php Part:

<?php

mysql_connect("localhost","root","") or die (mysql_error());

mysql_select_db("yorum") or die (mysql_error());

if ($_POST['comType'] == "parseComment") {

    $name = $_POST['userName'];

          $location = $_POST['userLocation'];

    $comment = $_POST['userMsg'];

  

    $sql = mysql_query("INSERT INTO guestbook (name, post_date, comment, location)

        VALUES('$name', now(),'$comment','$location')") 

        or die (mysql_error());

  

          $body = "";

    $sql = mysql_query("SELECT * FROM guestbook ORDER BY post_date DESC");

    while($row = mysql_fetch_array($sql)) {

                    $id = $row["id"];

                    $name = $row["name"];

                    $post_date = $row["post_date"];

                    $comment = $row["comment"];

                    $location = $row["location"];

 

                    $comment = stripslashes($comment);

                    $name = eregi_replace("&#39;", "'",  $name);

                    $location = eregi_replace("&#39;", "'",  $location);

                    $comment = eregi_replace("&#39;", "'", $comment);

 

                    $post_date = strftime("%b %d, %y", strtotime($post_date));

                    $body .= '<u><b><font color="#790000">' . $name . '</font>    |    <font color="#9B9B9B">' . $location . '</font>      |      <font color="#9B9B9B">' . $post_date . '</font></b></u>

                    <br />

                    '.$comment.'

                    <br />

                    <br />

                    ';

          }

    mysql_free_result($sql);

    mysql_close();

          

 

     echo "return_msg=Entry has been added successfully $name, thanks!&returnBody=$body";

     exit();

}

if ($_POST['comType'] == "requestEntries") {

  

    $body = "";

    $sql = mysql_query("SELECT * FROM guestbook ORDER BY post_date DESC");

    while($row = mysql_fetch_array($sql)) {

                    $id = $row["id"];

                    $name = $row["name"];

                    $post_date = $row["post_date"];

                    $comment = $row["comment"];

                    $location = $row["location"];

                    $comment = stripslashes($comment);

 

                    $post_date = strftime("%b %d, %y", strtotime($post_date));

                    $body .= '<u><b><font color="#790000">' . $name . '</font>    |    <font color="#9B9B9B">' . $location . '</font>      |      <font color="#9B9B9B">' . $post_date . '</font></b></u>

                    <br />

                    '.$comment.'

                    <br />

                    <br />

                    ';

          }

    mysql_free_result($sql);

    mysql_close();

    echo "returnBody=$body";

    exit();

}

?>

TOPICS
ActionScript
2.4K
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

correct answers 1 Correct answer

Community Expert , Feb 20, 2014 Feb 20, 2014

use the trace function to debug:

function completeHandler(event:Event):void{

          processing_mc.visible = false;

          name_txt.text = "";

          msg_txt.text = "";

          status_txt.text = event.target.data.return_msg;

          gbOutput_txt.condenseWhite = true;

trace("::"+event.target.data.returnBody+"::");

          gbOutput_txt.htmlText=""+event.target.data.returnBody;

}

// and then initialize $body outside those if-statements or ensure you're sending an appropriate comType variable a

...
Translate
Community Expert ,
Feb 20, 2014 Feb 20, 2014

use the trace function to debug:

function completeHandler(event:Event):void{

          processing_mc.visible = false;

          name_txt.text = "";

          msg_txt.text = "";

          status_txt.text = event.target.data.return_msg;

          gbOutput_txt.condenseWhite = true;

trace("::"+event.target.data.returnBody+"::");

          gbOutput_txt.htmlText=""+event.target.data.returnBody;

}

// and then initialize $body outside those if-statements or ensure you're sending an appropriate comType variable and value. 

// right now it doesn't look like you're even sending comType with varSend.

// ie, you must assign the urlrequest data property AFTER urlvariable variables/values are assigned.

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
New Here ,
Feb 20, 2014 Feb 20, 2014

var message:String= event.target.data.return_msg;

          if(!message) message="";

           status_txt.text =message;

I think this part fix error message but I have big problem with php part.I don't know php very well.I check database and no comment adding to database.Some of php codes show in comment panel.And can't see and can't see comments.

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 ,
Feb 20, 2014 Feb 20, 2014
LATEST

again,

// right now it doesn't look like you're even sending comType with varSend.

// ie, you must assign the urlrequest data property AFTER urlvariable variables/values are assigned.

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