(visit URL __ and then do..) server trouble

brantsmith

  • Posts: 151
Hey guys. I have been working on a flash level editor for my game in which others can log onto a website, create a level in my editor, and it then gets sent to my email adress. I successfully got everything to work inside of stencyl. I am using the block (Visit URL ___ and then do...) to send off string data to a hosted php file. When I hit test game inside of Stencyl and run the game, it sends off the data perfectly. Everything works like it is supposed to. However, I recently uploaded the exported .swf to dropbox and embedded the .swf file in a hosted webpage. When I load up the game on the webpage, it displays correctly, but will not send the data. I can go back to stencyl and open up the game and it sends the data fine. But the same .swf embedded on a webpage will not send the data. I tried troubleshooting this by placing a (open URL ____ ) block inside the (Visit URL ___ and then do..) block, so that it will visit a given URL if it posts the data. and sure enough, it doesnt open the URL, as if to say that it failed to post the data. I'm quite puzzled on this one. If anyone out there has any bright ideas please let me know. I have put quite a bit of time into this.

--Edit.
I have done a bit of research and it seems others have the same problem exporting from flash professional.
--
" Look after it in File>Publish Settings.. Should appear window. Go to "Flash" tab and change "Local playback security" option to "Access network only". Should work."
--
Is there a similar setting in stencyl to edit.

« Last Edit: August 27, 2013, 06:23:32 pm by brantsmith »
Coding is Awesome.
Stencyl is Better.

captaincomic

  • *
  • Posts: 6108
If the SWF and the data are not on the same server you need a crossdomain.xml policy file.
http://help.adobe.com/en_US/as3/dev/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c85.html#WS5b3ccc516d4fbf351e63e3d118a9b90204-7e08

The console message says that it was looking for a crossdomain.xml at the default location (root of the server to host the data) and did not find one.

Create a file called "crossdomain.xml" with the following contents and put it at the root of the server

Code: [Select]
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
  <allow-access-from domain="*" />
  <site-control permitted-cross-domain-policies="all"/>
</cross-domain-policy>
You should not keep that file like that on your server as it allows access from any domain, just use it to test if it works. If it works change the domain from "*" to the domain where your SWF is hosted.

If you're not allowed to put it at the root you can put it somewhere else and load it with the following code:
Code: [Select]
Security.loadPolicyFile("http://www.example.com/sub/dir/crossdomain.xml");

brantsmith

  • Posts: 151
I've been lookin for the past couple of hours straight with no success, but this did it. Appreciate it man.
Coding is Awesome.
Stencyl is Better.