Topic: simple php/flash question (I hope) (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=22303" title="Pages that link to Topic: simple php/flash question (I hope) (Page 1 of 1)" rel="nofollow" >Topic: simple php/flash question (I hope) <span class="small">(Page 1 of 1)</span>\

 
fubbs
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Jun 2004

posted posted 06-24-2004 08:27

hi-

Been trying to expand my php skills, and I'm having a problem with php and flash.

I've setup a simple script in flash using loadVars that submits the contents of a textfield to a php script that then emails me the results. The problem is that it keeps popping up a new browser window when I hit the "send" button. Here's the actionscript:

sender = new LoadVars();
send.onPress = function() {
sender.message = _root.info.text;
sender.send("email.php", "sender", "POST");
};

I am running the swf from the server through a browser. Here's the basic php script:

<?php mail('me@you.net','message from me@you.net',$_POST['message'],'from: you.net');
?>

Is there a problem with the actionscript or the php? Any help is appreciated - thanks

(Edited by fubbs on 06-24-2004 08:28)

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-24-2004 13:00

well... let's see
- php runs on the server, and can't interact with the user's browser
- flash runs on the client, and can interact with the user's browser.

Which one is it?

(And don't ask me about the flash - I don't know. But I'm moving this to the appropriate forum.)

Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

posted posted 06-24-2004 15:22

I think you need to define a corresponding LoadVars receiver object to deal with what comes back. LoadVars can be a two-way exchange. When the data comes back, the receiver LoadVars would have an onLoad callback to write the returned data to a TextField. I can't get into the specifics now, but maybe that will be enough to get you going. The fact that you are getting the data returned from PHP indicates that the script is working okay. You just need to tell Flash what to do with what comes back.

BTW - hope this is just a typo in your post and not in your ActionScript:

code:
send.onPress = function()



should be "sender.onPress", right? And I personally would use onRelease instead of onPress

Steve
Maniac (V) Inmate

From: Boston, MA, USA
Insane since: Apr 2000

posted posted 06-24-2004 16:18

Addendum:
I wrote a little thing on a Flash/PHP mail form. It's not exactly what you are doing here, but the fourth page ( http://www.thegoldenmean.com/technique/flashMX_mailform4.html ) demonstrates constructing a two-way LoadVars exchange. Might be all you need to get this worked out.

(Edited by Steve on 06-24-2004 16:19)

fubbs
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jun 2004

posted posted 06-28-2004 05:44

Tyberius: Don't worry - I won't ask you anything. Ever. Good to know that this is the response I can expect from a moderator. Really helpful.

Steve: Thanks. I think the stuff you wrote will help. I was using "sender.send" (as opposed to "sendAndLoad") - thought that this method would not need a response back from the server.

Btw, regarding

send.onPress=function()

'send' is a movie clip that I'm using as a button. Just assigning functionality to it externally.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu