Copy link to clipboard
Copied
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
...
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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");
}
}
}
Copy link to clipboard
Copied
Have you tried using a relative address for the ashx file instead of the absolute URL?
my_post.sendAndLoad("GetPlayerAction.ashx",my_receive,"POST");
Copy link to clipboard
Copied
My swf and html files are on one server and the database a different one. Is that a problem?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
exactly!
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now