Skip to main content
Known Participant
April 13, 2023
Question

How to use jsfl to call the code in the swf expansion panel

  • April 13, 2023
  • 1 reply
  • 875 views

Here is the function code in the swf panel

Example01.addEventListener(MouseEvent.CLICK, onBtnClick);

function onBtnClick(e:MouseEvent):void {

var jsfl:String = new String();

jsfl += "an.getDocumentDOM().getTimeline().convertToKeyframes();\nvar doc = fl.getDocumentDOM()\nvar c = doc.getTimeline().currentFrame;\nfl.getDocumentDOM().getTimeline().setSelectedFrames(c-0,c-0);\nan.getDocumentDOM().setElementProperty('loop', 'play once');\n;";	
		
MMExecute(jsfl);

}
This topic has been closed for replies.

1 reply

Vladin M. Mitov
Inspiring
April 13, 2023
- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
kqskcmAuthor
Known Participant
April 13, 2023

Could you please help me to see how to solve it?

I hope to use jsfl to add shortcut keys to the functions in the panel

fl.getDocumentDOM().javaAction = "?";
fl.getDocumentDOM().javaPanel = "my panel";

https://drive.google.com/file/d/1r_J-6JpLMYQsBO45HTSUr4WCHYGV9ZFs/view?usp=sharing 

Vladin M. Mitov
Inspiring
April 13, 2023

If you want to call an AS3 function defined in an SWF panel, use swfPanel.call(), as shown in this link:
https://github.com/AdobeDocs/developers-animatesdk-docs/blob/master/swfPanel_object/swfPanel.md

If you want the function in the panel to also work with a keyboard shortcut, you need to use a KeyboardEvent listener:
https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/KeyboardEvent.html


- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation