Embedded jsx and CSXSInterface calls

General Discussion of Scripting for Flex, Flash & CS SDK

Moderators: Tom, Kukurykus

undavide

Embedded jsx and CSXSInterface calls

Post by undavide »

Hello,
I usually don't like cross posting, but I'd really need help on this one; so here is what I've asked in Adobe forums with no luck so far...

I know, from the Zak Nelson CS SDK cookbook, how to embed and then call a jsx:

Code: Select all[ Embed (source= "myScript.jsx" , mimeType= "application/octet-stream" )]
private static var myScriptClass:Class;
var jsxInterface:HostObject = HostObject.getRoot(HostObject.extensions[0]);
jsxInterface.eval( new myScriptClass().toString());

I've used this method in a Photoshop CS5 extension, that I have to port to CS4 - so I need to use the old way:

Code: Select allCSXSInterface.instance.evalScript("myFunction", "myParameter");

which works for functions inside a jsx exactly named as the swf panel. (see the Photoshop panel developer's guide)

I'd rather like to embed within the SWF several, differents JSX:

Code: Select all[ Embed (source= "myScript.jsx" , mimeType= "application/octet-stream" )]
private static var myScriptClass:Class;
Embed (source= "myScript2.jsx" , mimeType= "application/octet-stream" )]
private static var myScriptClass2:Class;

and then call functions in them via CSXSInterface.

I've tried something like:
Code: Select allmyScriptClass.CSXSInterface.instance.evalScript("myFunction", "myParameter");
without any luck.

What's the correct syntax for such call? (if there's one...)
Thanks in advance,

Davide

PS
I'm trying to do that because I've noticed that one large JSX that contains all the stuff I need behaves weirdly in Photoshop when called from the panel, while launching the same JSX as a script works fine - so hopefully splitting the code may be a workaround. I'm not that confident on this one, but it would be worth a try.
benz.w

Embedded jsx and CSXSInterface calls

Post by benz.w »

Hi Davide,

I don't have a solution to your problem, but maybe it's woth trying the Creative Suite ActionScript Wrapper (CSAW) libraries instead of embedding your jsx scripts into your panel...
CSAW is part of the CS5SDK (http://www.adobe.com/devnet/creativesuite/sdk.html).
Related info here: http://blogs.adobe.com/cssdk/2010/06/ge ... e_sdk.html...

Cheers,
Wolf
undavide

Embedded jsx and CSXSInterface calls

Post by undavide »

Hi Wolf,
thanks for your suggestion.
Actually, I needed to follow that way because while with CS SDK the jsx embedding and calling work properly, porting to CS4 it doesn't.
I mean, embedding a big jsx (with libraries, UI etc) leads to errors - so I've thought about embedding several smaller jsx and call them separately.
Cheers,

Davide