Expand my Community achievements bar.

Creating instances programatically

Avatar

Level 6
Hi,



I would like to create some instances with addinstance when a pdf is opened (without user interaction). I´m using this code at the layout ready event of the main form object. However, the cursor starts blinking as it was in a loop...



form1.P1.ItemSet.instanceManager.addInstance();



Thank you
2 Replies

Avatar

Former Community Member
Layout ready occurs after the layout manager determines the layout of the form. Adding an instance forces the layout manager to recalculate the layout of the form, causing layout ready event to occur. Etc etc, you're in an infinite loop. Try moving your script to doc:ready.



Chris

Adobe Enterprise Developer Support

Avatar

Level 6
Chris,



Thank you for your help.

Instead of using addInstance() method I rather used setInstances to set all the instances at the same time. Now is more easy to control the layout event, and I guess this method is more efficient than adding instance by instance.



Thank you