views:

235

answers:

1

Hi,

I am trying to debug ActionScript within CS4. The script, as you can see below, is making a GET request to a URL that I am hosting from my machine. When I try to debug the movie I get an message box that says:

Adobe Flash Player has Stopped a potentially unsafe operation. The local application that you are running on your computer: "C:\myapplication.swf" is trying to make a communicate with this Internet-enabled location:

localhost

To Let this application communicate with the internet click Settings.

So I click settings, and on the Global Security Panel that opens up in my browser, I select Always Allow, close my flash movie and try again. Same error.

Has anyone had this problem?

var requestVars:URLVariables = new URLVariables();
requestVars.ornTest = "test";
var request:URLRequest = new URLRequest();
request.url = "http://localhost/apps/game/tree/DesignFlash.aspx";
request.method = URLRequestMethod.GET;
request.data = requestVars;

var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.TEXT;
loader.addEventListener(Event.COMPLETE, loaderCompleteHandler);
loader.addEventListener(HTTPStatusEvent.HTTP_STATU S, httpStatusHandler);
loader.addEventListener(SecurityErrorEvent.SECURIT Y_ERROR, securityErrorHandler);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);

try
{
  loader.load(request);
}
catch (error:Error)
{
  trace("Unable to load URL");
}

private function loaderCompleteHandler(event:Event):void
{
  var variables:URLVariables = new URLVariables( event.target.data );
  if(variables.success)
  {
  var ornArray = deserializeString(variables.ornData);
  for(var i:int=0;i<ornArray.length;i+=3)
  {
    addOrnamentProperty(ornArray[i],ornArray[i+1],ornArray[i+2]);
  }
      addOrnamentsFromArrayList();
  }
}
+1  A: 

You need to add the folder to the list of allowed folders.

Follow this url:
http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

From the drop down menu that says "Edit Locations..." choose "Add Location..." then browse to the correct directory (the one with the SWF file in it) and add that directory. If your HTML file is in a different directory than the SWF file then I can never recall which one to add so I would add them both.

The other thing you could do is to run your project through a HTTP server running on your own computer. This can be a bit more involved (e.g. you have to get a HTTP server running and then publish your HTML and SWF to the directory). Adding the folder is the most simple and direct approach but if you use a local server then you won't have any restrictions.

James Fassett
Does the HTML output of Flash or the HTML page I am running the flash in have to be in this accepted folder? Thanks
Adrian Adkison
Want to test the comment section, please ignore this comment
Adrian Adkison
As I said in the answer - if the HTML and SWF are in different directories I add them both.
James Fassett
There are two different HTML files that we are talking about. One has the swf file embedded into it to run on the web. The other HTML page is the one that is generated by flash along with the swf file. I have all three in the same folder. No luck still. Thanks for your help.
Adrian Adkison