Flex Panel and call on jsx file

General Discussion of Scripting for Flex, Flash & CS SDK

Moderators: xbytor, DavideBarranca, Paul MR

bungdaddy

Flex Panel and call on jsx file

Postby bungdaddy » Mon Mar 05, 2012 8:05 pm

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 all
import 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 all
function sayHello () {
        alert("Hello");
}



csuebele

Flex Panel and call on jsx file

Postby csuebele » Thu May 24, 2012 2:38 pm

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 all
flashVar.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.


Return to “Flex, Flash & CS SDK: General Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest