Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Nov 13, 2013 Nov 13, 2013

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

TOPICS
ActionScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 14, 2013 Nov 14, 2013

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 rece
...
Translate
LEGEND ,
Nov 13, 2013 Nov 13, 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 13, 2013 Nov 13, 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");

   

                    }

          }

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 14, 2013 Nov 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");

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 14, 2013 Nov 14, 2013

My swf and html files are on one server and the database a different one.  Is that a problem? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 14, 2013 Nov 14, 2013

It is probably a security issue.  You might need to set up some form of permisions to allow access to/from a different domain.  I am by no means knowledgeable in security matters.  I'll see if I can get someone who is to help if they can. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2013 Nov 14, 2013

ned's correct:  that's a security sandbox issue.

you'll need to use a gateway file on the server with your swf (that will do that cross-domain querying), or you'll need a cross-domain security permissions file in the root of the server with your database.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 14, 2013 Nov 14, 2013

Is a gateway file something like a local PHP file (or an ASP file) that you use as a middleman to extract/return the data due to it not having the same security issues that Flash has?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2013 Nov 14, 2013

exactly!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 14, 2013 Nov 14, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 14, 2013 Nov 14, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 14, 2013 Nov 14, 2013

You guys did it.

Your information helped me to find this:

http://kb2.adobe.com/cps/142/tn_14213.html

...which describes how to make a very simple .xml file that belongs on the database domain/server. 

Thank you,

Peter

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 15, 2013 Nov 15, 2013
LATEST

you're welcome.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines