Skip navigation
Currently Being Moderated

Modal dialog extension

Jun 21, 2012 9:38 AM

I am building a hybrid extension that uses flash for the UI.  The extension is a modal dialog that has a Ok button, that when pressed, closes the dialog and sends an event to the plugin that makes changes to the current document.

 

The problem I am running into is that I simply can't get the dialog to close.  The plugin is getting the event and the artwork is modified, but the changes don't update (to the screen) until the dialog goes away.  I have tried a dozen different ways to close the dialog.  It seems that If I dispatch a csxs event before or after a close(), the dialog won't actually close.

 

One thing I tried was to catch the CSExtension.close event.  This is supposed to be called after the extension closes.  If I press the Escape key, the dialog closes, this event is fired and I can dispatch my event and everything works correctly.  But if I click my Ok button, the dialog doesn't close, and I get the same problem as before.

 

Here is my okClicked function:

 

private function okClicked():void

{                  

  // create the event here

  CSInterface.instance.dispatchEvent(event);

 

  close();

}

 

 

Other things I have tried:

 

  • adding an Event.EXISTING listener
  • adding a NativeApplication.nativeApplication Event.EXISTING listener
  • force closing the window by dispatching Event.EXISTING events, nativeWindow.close(), NativeApplication.nativeApplication.exit(), etc
  • dispatching Keyboard.ESCAPE key up event (to simulate the user pressing the Esc key)

 

Dispatching a csxs event during any of these will result in the dialog not closing.

 

Any suggestions?

 
Replies
  • Currently Being Moderated
    Jun 21, 2012 10:24 AM   in reply to T.Nelson

    What app is this with?

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 21, 2012 3:06 PM   in reply to T.Nelson

    Why don't you use CSXSInterface to request the extension to close and then catch the event the same way you are with escape?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 4, 2013 2:43 AM   in reply to T.Nelson

    At least on Mac, when a native dialog is shown on an modal extension window, both window's event handling get stuck.

     

    The workaround I took was to use AITimerSuite.

    When you receive an event, do nothing but store the event data and then activate a timer.

    After the modal extension is closed, the timer fires and the plugin can do the queued job.

    Hope this helps someone who cannot take modeless approach.

     
    |
    Mark as:
  • Currently Being Moderated
    Calculating status...
    Jul 23, 2013 8:26 PM   in reply to ranvis.

    Hi ranvis, Nelson, Harbs

    Are you get pressed ESC event before Modal dialog escape ?

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points