Stuck on CSXSinterface

General Discussion of Scripting for Flex, Flash & CS SDK

Moderators: Tom, Kukurykus

izo

Stuck on CSXSinterface

Post by izo »

hello, i do'nt find a way to execute javascript with photoshop and flex interface.
i use the example of panel develloper guide but nothing happen when i execute it on photoshop cs4.

here the code : jsx
Code: Select allfunction addDocument(){
   app.documents.add();
}

function closeDocument(){
   app.activeDocument.close();
}


the mxml

Code: Select all
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
   <mx:Script>
      <![CDATA[
         import com.adobe.csxs.core.CSXSInterface;
         
         public var newDocTimer:Timer = new Timer(10000);
         public var closeDocTimer:Timer = new Timer(12000);
         
         public function callAddDocument():void{
            CSXSInterface.instance.evalScript("addDocument");
         }
         public function callCloseDocument():void{
            CSXSInterface.instance.evalScript("closeDocument");
         }
         public function init():void{
            newDocTimer.addEventListener(TimerEvent.TIMER,newDocTimeHandler);
            closeDocTimer.addEventListener(TimerEvent.TIMER,closeDocTimeHandler);
            newDocTimer.start();
            closeDocTimer.start();
         }
         public function newDocTimeHandler(event:TimerEvent):void{
            if(actNewDoc.selected) callAddDocument();
         }
         public function closeDocTimeHandler(event:TimerEvent):void{
            if(actCloseDoc.selected) callCloseDocument();
         }
      ]]>
   </mx:Script>
   <mx:Button x="10" y="10" label="New Document" click="callAddDocument();"/>
   <mx:Button x="10" y="40" label="Close Document" click="callCloseDocument();"/>
   <mx:CheckBox x="135" y="10" label="Activate every 10 seconds" id="actNewDoc"/>
   <mx:CheckBox x="135" y="40" label="Activate every 12 seconds" id="actCloseDoc"/>
</mx:Application>



and my project structure :

have in source - default package :
Test.mxml
Test.jsx

and in lib :
CSXSLibrary-2.0-sdk-3.4.swc

i have no error, the interface open in a photoshop panel, but nothing happen when i click a button.

Can you help me on that ?

i'm really stuck !

thanks a lot
Mike Hale

Stuck on CSXSinterface

Post by Mike Hale »

The code you posted works for me using Flex Builder and CS4 on Windows XP.

What OS are you using? Which app are you using to build the swf?
izo

Stuck on CSXSinterface

Post by izo »

hello Mike, thanks for reply. I'm really stuck on this.
i'm in windows 7 in 64 operating system, i try on cs4 and cs4(64 bits system)
i build the swf on Adobe flash builder 4

I try at home on vista, and i have the same problem. i miss something in the process maybe.
the interface is displaying well on cs4 but button don't call the function.

i build the project from flash builder 4 directly in the panel folder of photoshop. When i watch the folder,there is many thing and the jsx is here.
(also it's a flex project, it is ok ?)
izo

Stuck on CSXSinterface

Post by izo »

here some news.
i try directly the files sample in the devellopper guide. (shortcut button)
if i take the swf and the jsx and put it in panel folder, and launch the interface in photoshop cs4 it's crash.

so i import flex project in flash builder, for build it again, but i have this error :

Description Resource Path Location Type
configuration variable 'compiler.library-path' value contains unknown token 'CSXSLibraryLoc' shortcut buttons Unknown Flex Problem

i don't know what it is... any idea ?
Mike Hale

Stuck on CSXSinterface

Post by Mike Hale »

I can only tell you what works for me using Flex Builder 3. I have the project in a subfolder under my documents. When I am ready to test I export a release build. I then copy the swf and jsx files into the Photoshop panels folder.

I seem to remember that Windows 7 had/has problems with panels in CS4. I don't remember what or if it effected both 32 and 64 bit Photoshop. I know that one of my panels will not run on Windows 7 in CS4 because it registers events and that causes errors on the OS.
izo

Stuck on CSXSinterface

Post by izo »

i get a way to get it works, my problem was the same than here :

bb/viewtopic.php?f=26&t=3566

now i can succefully execute a javascript from flash player.
but i don't find a way to execute only a function inside the javascript