2009-01-15 14:41
浏览 43

在不同的计算机上的Actionscript 2中的LoadVars.sendAndLoad遇到问题

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(){
    this.enabled = false;
    var sendvar_lv:LoadVars = new LoadVars();
    var loadvar_lv:LoadVars = new LoadVars();
    loadvar_lv.onLoad = function(success:Boolean){
    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条回答 默认 最新

  • doutenglou6588
    doutenglou6588 2009-01-15 15:00

    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?

    点赞 评论
  • duanfengshang1088
    duanfengshang1088 2009-01-15 14:52

    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

    点赞 评论