Copy link to clipboard
Copied
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:
I’ve also tried setting the layer, creating new layers, etc., but nothing seems to work.
Documentation:
https://help.adobe.com/en_US/flash/cs/extend/index.html
Can you help me?
Copy link to clipboard
Copied
what if you import in batches of 100?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
add a timer to delay your batches.
Copy link to clipboard
Copied
I've alredy tested with delay.
function debugPause(ms) {
if (!ENABLE_PAUSE) return;
ms = ms || 10;
var start = new Date().getTime();
while (new Date().getTime() < start + ms) {}
}
Every 50 elements I wait some time... I think the cause of take a lot of time is the mumber of the elements.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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/
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
for 243 elements take 453s
for the first 100 takes 20s... after takes 2-5 seconds every symbol
Copy link to clipboard
Copied
if you load 100, delay 25 seconds and then load 100 how long does that take?
Copy link to clipboard
Copied
[Replied below]
Copy link to clipboard
Copied
This tutorial is a very nice introduction:
https://ajarproductions.com/blog/2011/02/08/creating-flash-extensions-pt1/
As an example, a simple for loop like this took around 17 seconds to complete, but it blocks Animate.
for (var i:uint = 0; i < 1000; i++)
MMExecute("fl.getDocumentDOM().library.addItemToDocument({ x: 0, y: 0 }, 'Rec');");
In this other example, Animate doesn't get blocked but it takes around 78 seconds to complete, which makes the need for visual feedback even more important.
import flash.events.Event;
import flash.utils.getTimer;
var count:uint = 0;
var total:uint = 1000;
function enterFrameHandler(e:Event):void
{
count++;
if (count < total)
MMExecute("fl.getDocumentDOM().library.addItemToDocument({ x: 0, y: 0 }, 'Rec');");
else
{
MMExecute("fl.trace('total time (MS): " + getTimer() + "');");
stage.removeEventListener(e.type, arguments.callee);
}
}
stage.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
But these are only quick tests that I run. You can explore other options as AS3 and the Flash API are very robust.
Regards,
JC
Copy link to clipboard
Copied
I've just create a impor.as3 file and I placed in C:\Users\USER\AppData\Local\Adobe\Animate 2024\en_US\Configuration\Commands\Import Profile.as
C:\Users\USER\AppData\Local\Adobe\Animate 2024\en_US\Configuration\Commands\Import Profile.as3
and the ADobe aNimate doesn't reconize the command to execute.
Copy link to clipboard
Copied
You actually need to create a SWF file and add it to the WindowSWF folder:
https://helpx.adobe.com/animate/kb/install-animate-extensions.html
If you can't find it, run this JSFL command:
fl.trace(FLfile.uriToPlatformPath(fl.configURI));
Find more inspiration, events, and resources on the new Adobe Community
Explore Now