Skip to main content
Multoman
Inspiring
Nov 26, 2022 6:59 AM UTC
Answered

Automatic launch of JSFL

How do I make the JSFL file activated during Animate startup?

This topic is closed to new replies. Start a new post to keep the conversation going.
Vladin M. Mitov
Vladin M. MitovCorrect answer
Inspiring
Nov 26, 2022 5:25 PM UTC

Yeah, just put the script in the "Tools" folder - the program reads and executes all "tool scripts" on start.


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

8 replies

Vladin M. Mitov
Inspiring
Nov 26, 2022 4:36 PM UTC

Hi,
I think, in Flash JS API there is no such functions as setTimeout(), so you can't use the standard approach with timer that executes a function periodically. But you may simulate some kind of similar behaviour, using

 

fl.addEventListener( "selectionChanged", yourFunc );

 


Because the user changes the selection frequently, this can be used as a "tick" event
in combination with a check for time elapsed. For example:

 

var startTime = new Date();
var myDelay = 10000; // 10 seconds

fl.addEventListener( "selectionChanged", saveFileFunc );

function saveFileFunc(){
	
   if( new Date() - startTime >= myDelay ){
	   
	   // save file
	   // .........................
	   
	   
	   // and reset the time
	   startTime = new Date();
   }
}

 

 

 

Translate
- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
Multoman
MultomanAuthor
Inspiring
Nov 26, 2022 4:49 PM UTC

Thank you, this is a very good example

Translate
kglad
Community Expert
Community Expert
Nov 26, 2022 2:39 PM UTC

you can execute jsfl commands with as3.

 

is that what you want?

Translate
JoãoCésar17023019
Community Expert
Community Expert
Nov 26, 2022 1:04 PM UTC

Hi.

 

I'm not sure if that's possible.

 

There some events that can be listened, like:

"documentNew", "documentOpened", "documentClosed", "mouseMove", "documentChanged", "layerChanged""timelineChanged", "frameChanged", “prePublish”, “postPublish”, “selectionChanged”, and dpiChanged.

 

https://help.adobe.com/archive/en_US/flash/cs5/flash_cs5_extending.pdf#page=269&zoom=100,118,704

 

What exactly do you need to do?

 

Regards,

JC

Translate
Multoman
MultomanAuthor
Inspiring
Nov 26, 2022 3:23 PM UTC

I want to create a command that saves the FLA file after a certain time. This is a replacement for the keyboard shortcut (Ctrl+S). I know that this can be done without problems using the swf panel, but then in order for the command to work, you need to keep the panel always open. Not all users will be happy about this. Is there a way to run such a script after a certain time? I would use the mouseMove event, but this option seems to me not optimized

Translate