Skip to main content
anthonyl89052030
Inspiring
January 9, 2025
Answered

JSFL Supporting Mulitple Source Files

  • January 9, 2025
  • 1 reply
  • 409 views

Hi there, while creating an animate tool I've been able to access functions from other JSFL files. I've achieve this by adding this line at the top of each script:

var utilities_script = fl.configURI + 'WindowSWF/' + "utilities.jsfl";

 

And then when I need to actually call a function in (for example) utilities, I call this:

fl.runScript(utilities_script, "DistributeKeyFrames", distributionNumber);

However, following the first call to the utilities script I can then access any function from utilities directly without the need to the fl.runScript call. So for example, if I needed to call DistributeKeyFrames again, I'd call:

DistributeKeyFrames(3)

as if it was a local function. But this only works after calling the long fl.runScript the first time.

 

Would really appreate if someone could explain why this is so and also, is there a way to set things up during an initialisation where I could just  call the function directly from the outset!

Thanks

Ant

Correct answer Vladin M. Mitov

Hi,

Indeed, it is difficult to say exactly why the effect you describe is obtained without seeing the specific code. I assume that the DistributeKeyFrames() function, after the first call, remains as an object in memory and can then be called directly.

If you want to use it with a direct call every time, you can do the following:


1. Create a script named initialization.jsfl
2. Put the following code in it:

function configureTool(){
   // call without parameters
   fl.runScript( fl.configURI + 'WindowSWF/' + "utilities.jsfl", "DistributeKeyFrames" );
}

3. Put the script in the Tools folder.
4. Restart Animate.

The script should be executed automatically when Animate starts and then DistributeKeyFrames()
will be available for direct calls.





1 reply

Vladin M. Mitov
Vladin M. MitovCorrect answer
Inspiring
January 9, 2025

Hi,

Indeed, it is difficult to say exactly why the effect you describe is obtained without seeing the specific code. I assume that the DistributeKeyFrames() function, after the first call, remains as an object in memory and can then be called directly.

If you want to use it with a direct call every time, you can do the following:


1. Create a script named initialization.jsfl
2. Put the following code in it:

function configureTool(){
   // call without parameters
   fl.runScript( fl.configURI + 'WindowSWF/' + "utilities.jsfl", "DistributeKeyFrames" );
}

3. Put the script in the Tools folder.
4. Restart Animate.

The script should be executed automatically when Animate starts and then DistributeKeyFrames()
will be available for direct calls.





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

Thank you so much for the response.