Flex Panel and call on jsx file

General Discussion of Scripting for Flex, Flash & CS SDK

Moderators: Tom, Kukurykus

bungdaddy

Flex Panel and call on jsx file

Post by bungdaddy »

I am new to the scene and learning to develop PS panels designed in Flex. I am trying to create a simple function in a jsx file that will be called on when clicking a button. Here is what I have that I cannot get to work. I have both the swf file and the jsx file in the proper directory and named the same.

Code: Select allimport com.adobe.csxs.core.CSXSInterface;

protected function jsButton():void {
var result:SyncRequestResult = CSXSInterface.instance.evalScript("sayHello");
}

<mx:Button x="183" y="121" label="Open " width="82" click="jsButton()"/>


from the jsx file
Code: Select allfunction sayHello () {
        alert("Hello");
}
csuebele

Flex Panel and call on jsx file

Post by csuebele »

I haven't done this using Flex only straight actionScript code, and I really only used it to have extendscript control a flash window, but from what I can tell, you first need to define you function in extendscript as part of the swf. you should define and load your swf. This isn't the entire script, but your function should look something like this with "flashVar" being however you defined your flash moving in extendScript:

Code: Select allflashVar.sayHello = function(){
     alert("Hello");
}

The swf panel will not look for any function in your extendscript, it has to be tied to the swf object.