Skip to main content
May 3, 2012
Question

Submitting variables to an ASPX file WITHOUT opening new window

  • May 3, 2012
  • 1 reply
  • 736 views

Hello,

I'm trying to submit some variables from my flash to an aspx page on a different domain which will handle them and put them in a database.  I've tried a number of options, but the only ones that have worked also result in a new window/tab being opened, and I am trying to avoid this. 

For example, I tried a loadVars with the sendAndLoad() function, but it did not work because the "load" portion requires the aspx page to be on the same domain as the swf- which it is not.

the send() function does not work either, because it requires you to specify a target (_self, _blank, etc) and that causes a new tab to open, or a redirection on the current page- both unacceptable, as I am trying not to interupt the user's experience on the page the swf is featured on.  send() does succeed in submitting the variables, at least, but as I said, it opens a new tab/redirects current tab.

One solution is to enable outside domains access on the server-side, but this is not ideal.  I'm hoping for a flash solution.  Any thoughts?

here's the code:

var dataLoader = new LoadVars();

var junkLV:LoadVars = new LoadVars();

junkLV.onLoad = function(success:Boolean) {

    if (success) {

        trace("We are in business.");

        greenLight_mc._alpha = 100;

    }

    else {

        trace("FAIL");

        redLight_mc._alpha = 100;

    }

};

dataLoader.firstname = firstName;

dataLoader.lastname = lastName;

dataLoader.email = emailAddress;

dataLoader.dest = destination;

dataLoader.sendAndLoad("url.aspx", junkLV, "POST");

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
May 3, 2012

is that pseudo-code?  if not, there should be no cross-domain issue.

also, use "_self" in the send() method should not open a new window.

May 3, 2012

Thanks for the reply-

That's the actual code, though not all of it.  The sendAndLoad, for example, is actually inside an onRelease() for a button. 

Also "_self" is still no good because it causes the current page to be redirected.  I don't want any interuption of the page the flash is featured on at all.

kglad
Community Expert
Community Expert
May 3, 2012

the code you showed does not call a cross-domain aspx file.