PhotoshopCallback

Discussion of actual or possible Bugs, Anomalies and Documentation Errors

Moderators: Tom, Kukurykus

david

PhotoshopCallback

Post by david »

This is a bit of code from the Panel Developer's Guide's "color picker" sample:

Code: Select allpublic function PhotoshopCallback(eventID:Number, descID:Number):void{
   if(eventID == charToInteger("setd") || eventID == charToInteger("Rset")){
      getPSForeground();
      getPSBackground();
   }
}


I added a counter to see how many times this function is called:

Code: Select allpublic function PhotoshopCallback(eventID:Number, descID:Number):void{
   if(eventID == charToInteger("setd") || eventID == charToInteger("Rset")){
      count++;
      text1.text=count.toString();
      getPSForeground();
      getPSBackground();
   }
}


The first time I open the panel, every time I change the foreground or background color, the counter increments by one. If I close/minimize the panel and open it again, every time I change foreground or background color, the counter increments by two. The increment gets bigger by one as I close/open the panel.

It appears that closing the panel doesn't remove whatever listeners are attached to Photoshop. Could I modify the code so this wouldn't happen?
Mike Hale

PhotoshopCallback

Post by Mike Hale »

Is your panel persistent? If so closing the panel doesn't really close it.

If not you could try adding a window.close event to unregister the events.