How to detach an ExternalInterface registered Event?

General Discussion of Scripting for Flex, Flash & CS SDK

Moderators: Tom, Kukurykus

undavide

How to detach an ExternalInterface registered Event?

Post by undavide »

Sorry to crosspost here a question I've asked in the Adobe's forum, but I've seen Mike Hale did some work on event registering (for instance here) so possibly he or someone else could answer!

In a PS extension, I'm registering for an event this way:

Code: Select allprivate static const COUNTER:int = Photoshop.app.stringIDToTypeID( countAdd );
public static function addPSSpecificCase():void
{
   CSXSInterface.instance.evalScript(PhotoshopRegisterEvent, COUNTER.toString());
   ExternalInterface.addCallback(PhotoshopCallback + CSXSInterface.getInstance().getExtensionId(), myPhotoshopCallback)
}

Which is fine and it works. I still don't know how to remove the listener:

Code: Select allpublic static function detach():void
{
  // ??
}

Any suggestion is truly appreciated!
Thanks

Davide
undavide

How to detach an ExternalInterface registered Event?

Post by undavide »

Just after having posted this one, I've recalled the Photoshop Panel Developer's Guide (back to CS4).
Where they mention in the "Reserved Words" section both PhotoshopRegisterEvent and his companion PhotoshopUnRegisterEvent.
Being the HostAdapter event list quite incomplete, they should have documented a bit better the CSXSInterface/ExternalInterface... but finally I got it, so the CS SDK and me, we are friends again.
Cheers

Davide