Posted by mmx4 in SWF Studio V3 on Feb 07 2008, 05:41 am

Hi,

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 ?

Thanks.


Posted by AGo in SWF Studio V3 on Feb 07 2008, 06:41 am

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.


Posted by mmx4 in SWF Studio V3 on Feb 07 2008, 07:02 am


QUOTE: from AGo;43003
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.


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.


Posted by mbd in SWF Studio V3 on Feb 07 2008, 11:20 am

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.


Posted by mmx4 in SWF Studio V3 on Feb 08 2008, 02:36 am


QUOTE: from mbd;43010
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.


Thanks, that looks like a solution.