Skip navigation
AwdatPazzles
Currently Being Moderated

Close Button ('X') on UI extension

Dec 2, 2011 9:06 AM

Let me first state that I am very new to Flex/Flash/Illustrator.  So please forgive me if I use the wrong terms or concepts.  Using Illustrator CS5.1, Flex 3.6 SDK in Flash Builder 4.5, and Visual Studio 2010.

 

Some background.  I am developing a hybrid plugin for Adobe Illustrator.  The plugin is C++ and interfaces with a hardware device and an UI extension built on Flex/Flash.  It uses the CSXS library (version 2.0 based on Flex 3.4 SDK) to perform the communication between the extension and the plugin.

 

When the UI extension closes, I need the plugin to perform some tasks.  These tasks might be related to Illustrator and/or to the device it communicates with.  If the UI is closed using a button I add to the UI, the plugin runs the tasks as needed.  If the UI is closed using the 'X' button in the corner of the window, I can not get the CSXS interface dispatch events to carry over to the plugin.  This is the same dispatch events used from the UI button that I manually created and works fine.

 

I have tried capturing the exiting event from the NativeApplication and I do see myself entering the associated function to that capture.  The dispatch events run but I do not enter the corresponding functions in the plugin.

 

Below is one of several attempts at making this work (believe this was found on the Adobe forums):

 

public function init() : void

{

      ...

      NativeApplication.nativeApplication.addEventListener(Event.EXITING, windowedapplication1_closingHandler);

     ...

}

 

protected function windowedapplication1_closingHandler(event:Event):void

{

      event.preventDefault();

      //event.stopImmediatePropagation();

      CSXSInterface.getInstance().dispatchEvent(new CSXSEvent("com.testui.events.closing", CSXSEventScope.APPLICATION));

}

 

Again, windowedapplication1_closingHandler will process but the dispatched event is not seen by my plugin (when the 'X' is clicked).

 

I am open to doing this other ways.

 

Is there a way to disable/hide the 'X' in the corner of the window?

Am I just missing something obvious that would make the above work?  Am I not properly "capturing" and "halting" the exit event?

Should I move away from the CSXS Library and use sockets to perform this communication (though the closing of the extension may have the same affect on the socket communication)?

Something else?

 

I am currently working on Windows 7 64-bit (if that matters) but the plugin will have to work on Mac too.

 

Thank you for your time.

 
Replies
  • Currently Being Moderated
    Dec 6, 2011 7:45 AM   in reply to AwdatPazzles

    Hi,

     

    You could try asking/searching in the Creative Suite SDK or Extension Builder forums, you may get a response there since it sounds like the problem is with the CS Extension side of your hybrid extension. I'm afraid I can't think of a solution off the top of my head - others have had similar problems.

     

    Sorry I can't be of more help,

     

    Louis

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 6, 2011 7:57 AM   in reply to AwdatPazzles

    Th CS SDK forum is probably better for CS Extension specific questions.

     

    The correct way to handle it would probably be to listen for the standard StateChangeEvent fired when the panel is closed. If I recall correctly, the events are not fired correctly in Illustrator.

     

    You can create a "close" event handler for your extension and do whatever you like in that handler. The close event is launched when the extension is closed. The problem is that no events are launched in Illy when the panel is closed. It remains in a ghost state. It "thinks" it's really open. You can try to work up the parents of the extension and attach an event listener to the StageManager (I think it's 4 levels up). I don't know if it will work...

     

    You can also try to poll the status of the extension from your C++ plugin, but I'm not sure that you will get the correct status back.

     

    The CSXS architecture in Illustrator is a mess. Most of the other apps are a lot better.

     

    Harbs

    http://www.in-tools.com

    Innovations in Automation

     
    |
    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