IND 5.0, Actionscript
Hi All,
I have found that the command CSXSInterface.instance.evalScript("alert('x', 'y', false)") works fine in a normal run (i.e., displays the Alert dialog in InDesign), but causes InDesign to crash and close if the same code is run in the debugger.
Any ideas?
TYIA,
mlavie
There's no reason to be using evalScript in InDesign.
Try this method:
http://cookbooks.adobe.com/post_Communicating_between_JavaScript_and_t he_Creative-17383.html
Harbs, thank you very very very much for the link. It's very nice technique.
But I have one question to you. Can I pass Array from jsx to sdk? I mean the real array, not a xml of string or anything?
On the very bottom of the post in the link you provided, theres an example:
var d:Document = new Document();
d.hostObjectDelegate = jsxInterface.getDocumentFromJSX();
And it works great, but only for SDK-specific classes, because they have a 'hostObjectDelegate" property/function.
Array doesn't have one, so how can i get an array from JSX?
Yes. You can pass an array, but it will not be an ActionScript Array type.
Type it as an Object (which is basically all a javascript Array really is), and it'll work as expected.
Something like this:
Javascript:
function getArray(){
return [1,2,3,4];
}
ActionScript:
var jsArray:Object = jsxInterface.getArray();
trace(jsArray[1]); // returns "2".
Harbs
North America
Europe, Middle East and Africa
Asia Pacific