PDA

View Full Version : Using a form in .swf in ScrollPane


robpet
04-26-2005, 05:25 PM
I'm building a page which uses a ScrollPane to load other pages.

Essentially, when a button (nav) is clicked, it changes the frame in the root movie, which then uses a new ScrollPane, and which loads a new page (actually another swf).

So, on one of those swf pages inside the ScrollPane, I want to have a form that emails. I can get the .swf form to work in the Test window of MX2004, but I can't get it to work when it's inside the movie. The auto-generated email places values of "undefined".

The sample scripts I used do use the _root.textfield.text code, which tells me it's trying to find the values in the main movie...which is not where I want it to find it...


Also, is there a way to make the email send automatically, instead of having it open, and the user needing to click 'send'?? I have been using the mailto: command, but that was just to make it work.


Any and all help would be appreciated.

Thanks guys!


rob

dankdoutz
05-22-2005, 04:38 AM
Also, is there a way to make the email send automatically, instead of having it open, and the user needing to click 'send'?? I have been using the mailto: command, but that was just to make it work.


Just a thought.. (cant say this is the best way...)

You could send the vars in a POST to a php script which will handle your email anyway you like.

EG

var c = new LoadVars();
c.userEmail = "user@yahoo.com";
c.sendAndLoad("email.php", c, "POST");
c.onLoad = function() {
//do something after a reply from php)
}

<?php
$emailToAddress = $userEmail;
$emailSubject = "my report";
$emailHeaders = "From: Bob Barker< bobbarker@nospam.org>\n";
$emailHeaders .= "X-Sender: < bobbarker@nospam.com>\n";
$emailHeaders .= "X-Mailer: PHP\n"; // mailer
$emailHeaders .= "X-Priority: 1\n"; // Urgent message!
$emailHeaders .= "Return-Path: < bobbarker@nospam>\n";
$emailHeaders .= "MIME-Version: 1.0\nContent-Type: text/html; charset=en";
$emailHeaders .= "cc: mary@nospam\n";
$emailHeaders .= "bcc: jim@nospam";

$emailMessage = "Hello world";

//Send email
mail($emailToAddress, $emailSubject, $emailMessage, $emailHeaders);

//tell flash that email was sent
echo "email sent&";

?>