views:

3115

answers:

2

Hi guys,

I'm writing a very simple flash app (AS 2) to sign users up to an email newsletter; the way it works is that it uses LoadVars to hit a (same-domain) PHP script via POST with the user's email address. The PHP script then passes the info through to another domain (the newsletter mailer URL) via curl to sign up the user.

So far, so good, and it works on roughly 70% of the computers on which it's been tested (it's being tested live from the website, not locally). However, on some computers, it doesn't appear that the LoadVars.sendAndLoad call is being made, as the email addresses sent from those computers aren't showing up on the subscriber list. I know that the PHP script still works on those computers as I've made a barebones HTML form that acts in exactly the way the Flash app does (POSTs to same PHP script with same variables, etc) and it works on all computers.

Here's the relevant AS:

submit_btn.onRelease = function(){
    submitOutAnimation();
    this.enabled = false;
    var sendvar_lv:LoadVars = new LoadVars();
    var loadvar_lv:LoadVars = new LoadVars();
    loadvar_lv.onLoad = function(success:Boolean){
        gotoAndStop("successful");
    }
    sendvar_lv.email = entryField_mc.myAdd.text;
    sendvar_lv.sendAndLoad("http://notmyrealdomainname.com/passthrough.php?ck="+new Date().getTime(),loadvar_lv,"POST");
}

Could this be a security problem with the Flash client settings? Do you have any other ideas? I've been under the impression that there isn't much variation in Flash playback across different computers (other than performance) assuming they have the same flash player version, and this experience is shattering that illusion...

+2  A: 

if you try to access a script that is not in the same domain (even subdomain) you have to put a cross-domain policy file in your server-root (crossdomain.xml)

read more: http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14213

sugarhilllabs
+2  A: 

It may depend on whether the user enters the "www" prefix, since it would be considered a separate subdomain. If the Flash resides on the same server, why not drop the "http://notmyrealdomainname.com" and use a relative path to passthrough.php?

Chris