/    Sign up×
Community /Pin to ProfileBookmark

sending email from a flash file

Hello guys I´m having a little problem. I´m trying to send some information from a flash form to an email address, and I´m doing that using a php file,

In the flash file I call this function: loadVariablesNum(“enviaForm.php”, 0, “POST”);

The enviaForm.php file has this code

<?

$to = “[email protected]“;
$subject = “Contact”;

$mailheaders = “Message coming from the site n”;

$mailheaders .= “Answer to: $emailnn”;

$msg = “Name: $namen”;
$msg .= “E-Mail: $emailn”;
$msg .= “Message: $messagenn”;

mail($to, $subject, $msg, $mailheaders) or die (“Error sending the message!”);

?>

After the user presses “send”, all the variables are being sent ok, but one, ($message) that is a text field that is inside a movie clip. So my question is; Is there a way I can retrieve this text fields value that is inside a movie clip that is in the same scene as the other variables? Thanks a lot.

to post a comment
PHP

12 Comments(s)

Copy linkTweet thisAlerts:
@BeachSideFeb 14.2005 — You have to make sure that the textbox in Flash is dynamic and the variable name is 'message' without the single quotes.

I am not sure how familar you are with Flash so I do not know how detailed to get for this.

::Edit:: oh and also you have to set the movie clip as 'Export for Action Script'
Copy linkTweet thisAlerts:
@joao_brauthorFeb 14.2005 — Ok, the textbox in Flash is dynamic and the variable name is 'message' without the single quotes, the problem is that it is inside a movie clip. I´m just not sure on how to set the movie clip as 'Export for Action Script' and even if that will work, as I said the other variables are being sent to the email correctly. The problem is just with this textbox that is inside the movie clip.
Copy linkTweet thisAlerts:
@BeachSideFeb 14.2005 — No problem you have to export the mc vars in actionScript

to do this go to the library (F11) find the movie clip. Right click the movie clip (i assume you are on windows) and click on 'Linkage' Then check the box that says 'Export For ActionScript'

and that is it ?
Copy linkTweet thisAlerts:
@joao_brauthorFeb 15.2005 — Ok I did the 'Export For ActionScript' thing. For some reason it still doesn´t work, I´m not sure if that is actually exporting the mc vars. Do I need to be using something like this:

mc.txtfield.text= somthing;

?
Copy linkTweet thisAlerts:
@BeachSideFeb 15.2005 — hmmm well to find out if it is sending the variables out make a little script to gather them

First for the .fla file -

Make 2 keyframes.

In the first keyframe -

select the keyframe and then actions(F9) put 'stop'.

Next with frame 1 selected make a mc and inside the mc create a button and an "Input Text" field name the variable whatever you want i'll call it mc_var make the text selectable and make sure you have embedded all the characters you need to show otherwise you won't be able to see any typing. I like to have a border to make it a clearly defined text area. Go back to scene 1 and select the mc and then actions(F9). In the actions put

[code=php]
onClipEvent (data) {
gotoAndStop(2);
}
[/code]


This tells it that when the data is passed to the file to goto and stop on frame 2 which will be the thank you page. Double click the mc and select the button and then actions(F9). in there put...

[code=php]
on (release) {
getURL("output.php", "", "POST");
}
[/code]


That is it as far as Flash is concerned. Don't forget to go to frame 2 and put a thank you you sent your stuff message.

Now make a file that will recieve your variables I called mine output.php

in the body put [code=php]
<?php echo $_POST['mc_vars']; ?>
[/code]


save the .swf and .php files stick the .swf in an .htm file and go to town ?

here is a zip of all the files I talked about. I made a little demo for you so that you can see what you have done different than I.

Good luck!

[upl-file uuid=e3aad8e2-af93-49ac-9c21-a0981ed8f5e8 size=20kB]flash_help.zip[/upl-file]
Copy linkTweet thisAlerts:
@joao_brauthorFeb 15.2005 — First of all thanks for your help. I took a look at your .fla file and it pretty much looks like mine, the whole problem with mine is that the submit button the one that actually calls the .php file is in the main time line and the textbox that I named 'message' is (and needs to be) inside a movie clip(which I named questions).

So I tried something like this;

mesg = questions.message.text;

to get its value, but it doesn´t work. The variable that should be sent to the .php file is the mesg. But I still haven´t got it to do it.
Copy linkTweet thisAlerts:
@BeachSideFeb 15.2005 — No problem man I love helping ?

the button location doesn't matter main timeline in a mc... what is important is the send as POST and the var name.

When you try to output the text though you need to call it via the POST so that is why on the htm page you want that <?php echo $_POST['mesg']; ?>
Copy linkTweet thisAlerts:
@joao_brauthorFeb 16.2005 — Well then I don´t know what is going wrong because using the same .fla that you created I took the button out of the movie clip placed on the main time line and it didn´t work, as it did when it was in the movie clip.
Copy linkTweet thisAlerts:
@joao_brauthorFeb 16.2005 — Well then I don´t know what is going wrong because using the same .fla that you created I took the button out of the movie clip placed on the main time line and it didn´t work, as it did when it was in the movie clip.
Copy linkTweet thisAlerts:
@BeachSideFeb 18.2005 — Sorry I took so long to reply, had some server issues ?

Anyway I'm sorry I forgot to include one more step if you want to have your button outside the mc on the main timeline.

You will need to give your movieclip an instance name such as "mc" (without the quotes) and you need to load the variable from the textfield in your mc into another variable at the button so your button script will look like this (also I renamed the textfield var to "text" so it is easier to distinguish the different var names)

[code=php]
on (release) {
mc_var = _root.mc.text;
getURL("output.php", "", "POST");
}
[/code]


included is the updated .fla file

[upl-file uuid=4eb1457d-941e-4f55-b042-d793e5cff44f size=3kB]mc_help.zip[/upl-file]
Copy linkTweet thisAlerts:
@joao_brauthorFeb 18.2005 — Yes that is what was missing, I finally figured that out and had it working properly yesterday. Thanks a lot for your help.
Copy linkTweet thisAlerts:
@BeachSideFeb 18.2005 — lol cool glad you got it working :p
×

Success!

Help @joao_br spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...