I would like to find out is as3 is doing is doing anything in the bakground. My exact problem is that i'm trying to package a document with the indesign sdk, right before that i'm importing xml, and the problem is that the document cant be save when packaging and i'm pretty sure that this is because the import is not ready yet. This is the code:
IDScriptingEventAdapter.getInstance().addEventListener(Document.AFTER_IMPORT, afterImport);
document.xmlElements.item(0).xmlElements.item("test").importXML(File.applicationStorageDirectory.resolvePath("temp/styles.xml"));
public function afterImport(event:ImportExportEvent):void {
var docPackaged:Boolean=app.activeDocument.packageForPrint(packagePath, true, true, true, true, true, true, true);
}
As you can see calling the function with the Document.AFTER_IMPORT
listener but for some reason it gets triggered to soon.
After some tests i've notice that the import is finished but the xmlElements arent in place yet by the time the handler gets executed. As a result of that, the document isnt ready by the time it gets packaged, so it can't save the document.
The correct error i'm getting is:
Cannot save a copy of “CataloogCS5.indd”.\n
So is there a way is can see if AS isnt doing anything anymore( all xmlElements are added) or a other solution to my problem?