Skip to main content
Participant
November 14, 2013
Answered

If sendAndLoad() returns properly in the swf, but not when embedded...

  • November 14, 2013
  • 1 reply
  • 1311 views

If sendAndLoad() returns properly in the swf, but not when embedded, does that mean I'm missing something in my html?

I'm using generic Flash embed code generated from Dreamweaver.  I can post more information if needed.

Thanks,

Peter

This topic has been closed for replies.
Correct answer kglad

Very helpful.

Is that because the database and my swf/html are in very different places? 

Are you talking about a PHP or ASP file that is embedding the swf?  (So a replacement for my HTML?)

I'm ready to research this but I don't quite know what to google.

Thanks,

Peter


peterbrinson wrote:

Very helpful.

Is that because the database and my swf/html are in very different places? 

yes, they are in different domains and adobe places restrictions on what a swf can do with data from a server in a different (from the swf's) domain.

Are you talking about a PHP or ASP file that is embedding the swf?

no.  you create an executable on the same server that hosts your swf.  that executable can query you database and not trigger any cross-domain issues.

your swf can send and receive data to and from that executable without triggering any cross-domain issues.

1 reply

Ned Murphy
Legend
November 14, 2013

It might mean you are mistargeting the file you are trying to interact with.  What is the directory structure of the files when the swf is embedded.

Participant
November 14, 2013

The swf and the html are in the same folder.  Here it is.  You can see the word 'false' on the left.  And the bad return below that. 

http://rehearsalsandreturns.peterbrinson.com/queryTest.html

...as a matter of fact, linking directly to the swf ALSO returns badly. 

http://rehearsalsandreturns.peterbrinson.com/comic3.swf

...and here's the link for the actual sendAndLoad(), that proves that the database is working:

http://rehearsalsdata.pieceit.net/GetPlayerAction.ashx?uniqueid=6BD6A888-018C-4184-AA65-43FC33C2DD28

It's only locally - the swf directly - does it work.  Because the online direct swf doesn't work, I wonder if I need to work on my AS2 code. 

Here it is, by the way:

/////////////////////////

onClipEvent (load) {

     my_post = new LoadVars();

          my_post.uniqueid = "6BD6A888-018C-4184-AA65-43FC33C2DD28";

          my_receive = new LoadVars();

          my_post.sendAndLoad("http://rehearsalsdata.pieceit.net/GetPlayerAction.ashx",my_receive,"POST");

          my_receive.onLoad = function(success)

          {

                    _root.encounter = success; // show true or false in a dynamic text field

          _root.showReturn = this; // show the return in a dynamic text field

                    if (success)

                    {

                 trace("success?: "  + success);

                              _root.gotoAndPlay(6);

                    }

                    else

                    {

                              trace("error");

   

                    }

          }

}

Ned Murphy
Legend
November 14, 2013

Have you tried using a relative address for the ashx file instead of the absolute URL?

   

my_post.sendAndLoad("GetPlayerAction.ashx",my_receive,"POST");