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
... View more