Page 1 of 1

where to catch a SecurityError?

Posted: 22 Dec 2008, 23:36
by sstark
Hello,

I need to catch a SecurityError in a try / catch for when it tries to connect to blueBox and fails because the server is not running. Instead of the Flash Player displaying an error in this case, I need to redirect to a URL and post a variable. The redirect code is done, just don't know where exactly in the API to catch this error.

Any help?

Posted: 23 Dec 2008, 00:13
by sstark
answered my own question.

in HttpConnection:

add in imports:

import flash.events.SecurityErrorEvent
import mx.core.Application

in 'send' method:

urlLoader.data = vars
urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, ioErrorHandler); // this is w hat's new
urlLoader.load(urlRequest)

then add this method:

private function ioErrorHandler(e:SecurityErrorEvent):void
{
mx.core.Application.application.displayErrorWindow(e.toString())
}

then in my main application I have a displayErrorWindow function that handles all errors.

Posted: 23 Dec 2008, 07:17
by Lapo
Instead of the Flash Player displaying an error in this case, I need to redirect to a URL and post a variable.

I am not following.
Does the Flash Player fires an error if the BlueBox is not found?
I don't get this behavior. I get my normal onConnection event which reports a failure in connecting.

Are you using the latest API? Version 1.5.6 ?

Thanks

Posted: 23 Dec 2008, 17:57
by sstark
Lapo wrote:
Instead of the Flash Player displaying an error in this case, I need to redirect to a URL and post a variable.

I am not following.
Does the Flash Player fires an error if the BlueBox is not found?
I don't get this behavior. I get my normal onConnection event which reports a failure in connecting.

Are you using the latest API? Version 1.5.6 ?

Thanks


yes, 1.5.6 is the API.

The problem arises when I try and connect when the server (sfs) has not been started. The onConnection handler does not catch this.

Posted: 23 Dec 2008, 20:49
by Lapo
I can't reproduce it. Can you drop us an email with simple client (SWF) example that fires that error?
I've tested with Flash Player 9 and 10-debug under MacOSX

Btw, happy Xmas! :)

Posted: 23 Dec 2008, 22:02
by sstark
I would normally love to send this to you, however this is a work production and everything is under NDA. Plus we're VERY deep into this project now, and creating a 'dummy' version would actually be a fair amount of work... Not to mention I got it to work ;) I can see why you want to track this problem down, however.

more information on the error. It's a SandBox error. The class is trying to open a socket to send the cross-domain policy (I believe), and since the server is not on it fails. This is before the initial connection.

Server specs:

Fedora (not sure if it's a core or not, or the version)
SFS
OpenSpace
Ruby on Rails using Mongrel
MySQL

And yes, a very merry Christmas to you as well! I hope you get whatever it is you've asked for, you deserve it and more!

p.s. - I just realized that I might of tested with SFS and RoR off, not just SFS off... this is because we can also test this project offline in the local projector.

Posted: 02 Jan 2009, 09:27
by Lapo
I see.
If the problem persist you can contact us directly. We have no problem signing an NDA. Then you can send us a link to the application so that we can see the problem in action.

As I said in my previous post we're not able to reproduce the problem by simply switching off the server

Happy new year :)