If i set onClose handler for my application, but application hangs.
(For example infinite loop), application will be unable to exit and will need to be closed by task manager. Ok, i understand this should not happen, but consider situation that project is very big.
Is there any gracefully method for handling this situation ?
well, if you application hangs in an infinite loop the best solution would be to recode that loop, especially in a big project ;)
if an application is stuck you can either kill it via task manager or hope that Flash`s SlowScript warning pops in and stops the script execution.
IIRC that should happen after 15 seconds, but I might be wrong, since the behavior of that "feature" was changed in FP9 by Adobe / by an oversight.
QUOTE: from AGo;43003
Problem is that you can't close application normally after SlowScript warning is displayed.
It is just a theoretical question. Of course no one will ever leave infinite loop in code intentionally ( except if you want to test something :) ). Problem is that adding onQuit event makes application hang completely in case SlowScript warning is displayed for whatever reasons it's happening.
You could listen for the slow script warning dialog using ssCore.App.setNotify (the onDialog event). When the slow script dialog appears the event handler function will be called and you can either clear your onQuit notification, kill the app, or stop the current code from running.
When I say stop the current code from running, I'm not talking about a magical hidden command. I just mean you should already have an understanding in your code about where things might get slow, like having to iterate through a lot of records, files, etc., and have a cancel mechanism (like a check for a variable) in place. The onDialog function could then trigger that mechanism.
QUOTE: from mbd;43010
Thanks, that looks like a solution.