Copy link to clipboard
Copied
How do I make the JSFL file activated during Animate startup?
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
...
Yeah, just put the script in the "Tools" folder - the program reads and executes all "tool scripts" on start.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
you can execute jsfl commands with as3.
is that what you want?
Copy link to clipboard
Copied
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();
}
}
Copy link to clipboard
Copied
Thank you, this is a very good example
Copy link to clipboard
Copied
js has both setTimeout and setInterval functions.
addendum: just noticed you said flash js.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Yeah, just put the script in the "Tools" folder - the program reads and executes all "tool scripts" on start.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now