Skip to main content
Multoman
Inspiring
July 15, 2023
Question

how do you think it is possible to run a jsfl script when opening a fla file?

  • July 15, 2023
  • 2 replies
  • 621 views

how do you think it is possible to run a jsfl script when opening a fla file? Moreover, the jsfl script itself is located inside the fla file

This topic has been closed for replies.

2 replies

Vladin M. Mitov
Inspiring
July 16, 2023

Yes, I think it's possible, but it depends on where and how the script that needs to be executed is stored.

Let suppose that you have a convention the JSFL code is stored as a frame comment on layer 1, frame 1 in the main timeline.
You need to have an initialization script installed in the Tools\ folder, which will load when the program starts. In this script, you can use the "documentOpened" event and define a function that, reads and executes the code.
Something like this:

 

fl.addEventListener( "documentOpened", function(){
	var doc = fl.getDocumentDOM();
	var script = doc.getTimeline().layers[0].frames[0].name;
	var ok = eval( script );
});

 



- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
Multoman
MultomanAuthor
Inspiring
July 16, 2023

It's not exactly what I'm looking for. The bottom line is that the user only needs to open the file without activating additional events. Most likely, this will not work because it may violate security, but perhaps there are workarounds?

Vladin M. Mitov
Inspiring
July 16, 2023

Oh, I see...
You want to deliver to the user a .fla file , which executes a JSFL code upon opening.
Unfortunately, I believe accomplishing this without any additional code installed on the user's side is impossible.

 

 

- Vlad: UX and graphic design, Flash user since 1998Member of Flanimate Power Tools team - extensions for character animation
kglad
Community Expert
Community Expert
July 15, 2023

yes, with as3 you can use mmexecute().