Skip to main content
Inspiring
July 2, 2025
Question

JSFL commands: Importing hundreds of elements takes a long time and freezes the application.

  • July 2, 2025
  • 2 replies
  • 677 views

When I try to import elements using a script I wrote, it takes a very long time. The first few elements take less than a second, but once the count reaches around 100 (I don't have an exact number), the import time increases to 2–5 seconds per element.

The problem is that Adobe Animate takes 5–10 minutes to run the script. If I delete this line, the script only takes about 5 seconds. Importing 10 elements takes just 10 seconds.

However, when importing hundreds of elements (e.g., 200), the import time increases with each element, and Adobe Animate becomes increasingly slow. At some point, if you click anywhere in Animate, the application crashes (on Windows 11 Pro).

I've tried several workarounds: importing in batches of 10 or 20 elements, cleaning the memory after each batch... but when the number of symbols is large, the app still crashes and stops responding.

The problem seems to be with this line:

 

lib.addItemToDocument({ x: 0.0 + x * elementIndex, y: y }, libPath);

 

I’ve also tried setting the layer, creating new layers, etc., but nothing seems to work.

Documentation:

https://web.archive.org/web/20121223105042/http://photoshop-flash-coreldraw-seo-help.com/adobe-flash-help-tutorials/control-tag-summary-of-xml-to-ui-in-flash.html#mc21

 

https://help.adobe.com/en_US/flash/cs/extend/index.html

 

 

Can you help me?

 

    2 replies

    JoãoCésar17023019
    Community Expert
    Community Expert
    July 3, 2025

    Hi.

     

    I would recommend you to consider using an AS3 extension as you'll possibly have more performance and more time management options (e.g.: Timer, ENTER_FRAME, setInterval, setTimeout).

    You'll at least be able to keep Animate usable and you'll also be able to create some loading message for your users.

     

    Regards,

    JC

    Inspiring
    July 3, 2025

    I never use AS3 files for commands. Do you recomend me any documentation to see the possibilities of import symbols, etc..?
    https://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/

     

    kglad
    Community Expert
    Community Expert
    July 3, 2025

    if you batch load 100 elements how long does it take?  (t1)

     

    if batch load 200 elements how long does it take?

     

    if you load 100, wait t1 and then load 100, how long does it take?

    kglad
    Community Expert
    Community Expert
    July 2, 2025

    what if you import in batches of 100?

    Inspiring
    July 3, 2025

    I've done with several batches, by 100 by 10, but when the number of the symbols are increased the script go slow.

    I don't know how to clean the memory between batches. I've tried document.selectnone(), but nothing works. I couldn't find any command to clean the memory to increase the speed.

    I've code in functions to test if this clean the memory in each call of every function. 

     

    kglad
    Community Expert
    Community Expert
    July 3, 2025

    add a timer to delay your batches.