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

AS3 Error

Explorer ,
Dec 03, 2014 Dec 03, 2014

Copy link to clipboard

Copied

Hello I am creating a contact form in Flash with AS3 and I am getting this error message:

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///Macintosh%20HD/Users/animationmanx/Desktop/mail.php

  at ContactMovie_fla::MainTimeline/sendMessage()

Here is the code

<?php

$to = "myemailHere.com";

$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";

}

?>

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";

}

I do have my real email in there I just took it out for this post.

TOPICS
ActionScript

Views

989

Translate

Translate

Report

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 , Dec 04, 2014 Dec 04, 2014

you already have that set:

my_loader.dataFormat = URLLoaderDataFormat.VARIABLES;

so you shouldn't see that error message if you're testing the code you posted.

Votes

Translate

Translate
Community Expert ,
Dec 03, 2014 Dec 03, 2014

Copy link to clipboard

Copied

there's no mail.php found in Macintosh%20HD/Users/animationmanx/Desktop/

Votes

Translate

Translate

Report

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 03, 2014 Dec 03, 2014

Copy link to clipboard

Copied

Ok thanks I fixed that but now it says:

Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.

  at Error$/throwError()

  at flash.net::URLVariables/decode()

  at flash.net::URLVariables$iinit()

  at flash.net::URLLoader/flash.net:URLLoader::onComplete()

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

assign your loader's dataFormat property to 'variables'.

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

I'm sorry I am really novice with ActionScript. What does that mean to

assign my loader's dataFormat property to 'variables'?

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

you already have that set:

my_loader.dataFormat = URLLoaderDataFormat.VARIABLES;

so you shouldn't see that error message if you're testing the code you posted.

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

I am still getting this message

Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs.

  at Error$/throwError()

  at flash.net::URLVariables/decode()

  at flash.net::URLVariables$iinit()

  at flash.net::URLLoader/flash.net:URLLoader::onComplete()

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

then you're not using the code you posted or your local computer doesn't support php.

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

What should I do?

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

copy and paste your actionscript into a new fla with those textfields and that button.

publish an html and swf and upload both to a server (that supports php).

copy that php to a text file, name it mail.php and upload to the same directory as your html and swf.

test.

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

Here is my code:

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";

}

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

i'm not sure what you mean by posting that last message.

again,

copy and paste your actionscript into a new fla with those textfields and that button.

publish an html and swf and upload both to a server (that supports php).

copy that php to a text file, name it mail.php and upload to the same directory as your html and swf.

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

It seemed to work like you said once I uploaded it to my website server. However, I haven't received the email.

Votes

Translate

Translate

Report

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 04, 2014 Dec 04, 2014

Copy link to clipboard

Copied

did you remember to change that email address?

Votes

Translate

Translate

Report

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 06, 2014 Dec 06, 2014

Copy link to clipboard

Copied

Thank you I just saw I didn't change it in the php file.

Votes

Translate

Translate

Report

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 06, 2014 Dec 06, 2014

Copy link to clipboard

Copied

so, all's well?

Votes

Translate

Translate

Report

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 08, 2014 Dec 08, 2014

Copy link to clipboard

Copied

Well, I thought so but the email never showed up in my inbox. Here is exactly what I have in the actionscript. And I uploaded the php file too.

this.stop();

<?php

$to = "myemailHERE";

$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";

}

?>

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";

}

Votes

Translate

Translate

Report

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 08, 2014 Dec 08, 2014

Copy link to clipboard

Copied

you need to change this line:

$to = "myemailHERE";

Votes

Translate

Translate

Report

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 08, 2014 Dec 08, 2014

Copy link to clipboard

Copied

I have the right email in that spot I just changed it for the purpose of this post. Is it right that I posted the php in the action script panel as well as uploading a separate file to my server?

Votes

Translate

Translate

Report

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 08, 2014 Dec 08, 2014

Copy link to clipboard

Copied

no php should be in your actionscript.  if it is, you should see compiler errors.

the php needs to be in a file named mail.php saved without text formatting (like ms windows would add).  ie, use a plain text editor like notepad or wordpad.

Votes

Translate

Translate

Report

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 09, 2014 Dec 09, 2014

Copy link to clipboard

Copied

I just got it to work completely. That must have been the last problem. That I made the php file using ms word. Thank you for  all the help, I really appreciate it!!!

Votes

Translate

Translate

Report

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 09, 2014 Dec 09, 2014

Copy link to clipboard

Copied

LATEST

you're welcome.

Votes

Translate

Translate

Report

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