Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Automatic launch of JSFL

Contributor ,
Nov 25, 2022 Nov 25, 2022

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

TOPICS
Code , Exchange extensions
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Engaged , Nov 26, 2022 Nov 26, 2022

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
...
Translate
Engaged , Nov 26, 2022 Nov 26, 2022

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


Translate
Community Expert ,
Nov 26, 2022 Nov 26, 2022

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 26, 2022 Nov 26, 2022

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
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 26, 2022 Nov 26, 2022

you can execute jsfl commands with as3.

 

is that what you want?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 26, 2022 Nov 26, 2022

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();
   }
}

 

 

 

- Vlad: UX and graphic design, Flash user since 1998
Member of Flanimate Power Tools team - extensions for character animation
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 26, 2022 Nov 26, 2022

Thank you, this is a very good example

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 26, 2022 Nov 26, 2022

@Vladin M. Mitov 

 

js has both setTimeout and setInterval functions.

 

addendum: just noticed you said flash js.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Nov 26, 2022 Nov 26, 2022

In order for this script to work, it must be activated at least once. Is it possible to do this, for example, when starting Animate?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 26, 2022 Nov 26, 2022
LATEST

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 1998
Member of Flanimate Power Tools team - extensions for character animation
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines