1 Reply Latest reply on Aug 30, 2010 4:32 AM by Harbs.

    CS4 CSXSLibrary: CSXSInterface.instance always null

    renderhjs2

      I wanted to start scripting custom panels for Photoshop CS4 but everytime I compile my FlexSDK (just pure as3, no flex code) I get errors saying:

      [Fault] exception, information=TypeError: Error #1009: Cannot access a property or method of a null object reference.

       

      So what that means:

      CSXSInterface.instance always turns out to be null. And it makes it impossible for me to communicate with any Photoshop or JSX functions.

       

      I am using CSXSLibrary-2.0-sdk-3.4.swc in combination with Photoshop CS4. Is that library perhaps not suited for CS4? Do I need a older library and if so where can I download it. Most of the libraries seem to be rather difficult to find on the internet.

       

       

      My AS3 source (just 1 class) looks like this:

       

      package 
      {
           import com.adobe.csxs.types.*;
           import com.adobe.csxs.events.*;
           import com.adobe.csxs.core.CSXSInterface;
           import flash.display.Sprite;
           import flash.events.Event;
           
           public class Main extends Sprite 
           {
                
                public function Main():void 
                {
                     if (stage) init();
                     else addEventListener(Event.ADDED_TO_STAGE, init);
                }
                
                private function init(e:Event = null):void {
                     CSXSInterface.instance.addEventListener(StateChangeEvent.WINDOW_OPEN, creationComplete);
                }
                private function creationComplete(e:Event):void {
                     
                }
           }
      }
      
      

       

       

      I get to display the SWF panel in photoshop but it ignores any commands that are associated with CSXSInterface.instance because it always results a NULL even within Photoshop.

      I downloaded the latest Photoshop Panel Developer's Guide archive which comes with CSXSLibrary-2.0-sdk-3.3 and CSXSLibrary-2.0-sdk-3.4.swc but I get the null result with booth libraries. Even though FlashDevelop clearly shows me that the swc library has been importet, I mean I can even access CSXSInterface just not the singleton instance.

       

      Any insight or input would be greatly appriciated

       

      edit:

      Some irritating bb shortcut triggered a pre release of my post.