2 Replies Latest reply on Dec 6, 2011 1:20 PM by AwdatPazzles

    Repost: Close Button ('X') on UI extension

    AwdatPazzles Level 1

      Note:  This was originally posted in the Illustrator SDK forums but was suggested to move it to here (I did not see an option to simply move the original post).


      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 the code entering the associated function to that capture when I am stepping it in Flash Builder.  The dispatch events run but I do not enter the corresponding functions in the plugin code.


      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




            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.



           I did try changing my extension from mx:WindowedApplication to csxs:CSXSWindowedApplication but that did not seem to have any affect.

        • 1. Re: Repost: Close Button ('X') on UI extension
          Harbs. Level 6

          Your issues are because it's an Illustrator extension. I gave you a few suggestions on the Illy forum.


          Do you need it to be a panel? If you can make your extension a dialog, you might be able to get more control over what happens when it closes...



          • 2. Re: Repost: Close Button ('X') on UI extension
            AwdatPazzles Level 1

            I did see your suggestions on the other forum but figured I would move the post while I researched and worked on trying those suggestions.


            As far as it needing to be a panel, I don't think that is really necessary (I am taking "panel" as referring to a Flex/Flash implementation).  The big thing for the UI is that it would be nice to have one set of code that works on both Mac and Windows which is why I was looking at a Flex/Flash implementation (I originally had a start on an Adm implementation but stopped working on that prior to reaching this point).


            Is removing/disabling the "X" on the "panel" not an option?  That would seem to be the easiest fix for this.