Note that there are some explanatory texts on larger screens.

plurals
  1. POJSFL: selecting items returned by fl.findObjectInDocByType()
    primarykey
    data
    text
    <p>I can't seem to use the info returned by <code>fl.findObjectInDocByType()</code> with <code>fl.getDocumentDOM().selection</code>.</p> <p>I want to use <code>document.setTextRectangle</code> to re-size some text fields from an array generated using <code>fl.findObjectInDocByType()</code>.</p> <p>I can easily access all the textObject properties but since <code>document.setTextRectangle</code> requires a current selection, I am at a loss.</p> <p>The example in the documentaion for setting selection is:</p> <pre><code>fl.getDocumentDOM().selection = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0]; </code></pre> <p><code>fl.findObjectInDocByType()</code> returns an array of objects with the attributes: (<code>object.timeline</code>, <code>object.layer</code>, <code>object.frame</code>, <code>object.parent</code>)</p> <p>But these are objects, and don't have a property for array index numbers required by <code>fl.getDocumentDOM().selection=</code>...</p> <pre><code>var doc = fl.getDocumentDOM(); var textFieldArray = fl.findObjectInDocByType("text", doc); for (var i=0; i &lt; textFieldArray.length; i ++){ fnResizeTheTextField(textFieldArray[i]); } function fnResizeTheTextField(theTextField){ //force current selection to be theTextField //doc.selection MUST be an array, so assign theTextField to an array... var selectArray = new Array(); selectArray[0] = theTextField.obj; var theTimeline =theTextField.timeline; var theLayer =theTextField.layer; var theFrame =theTextField.frame; doc.currentTimeline =theTextField.timeline; doc.selection = doc.getTimeline().theLayer.theFrame.selectArray;//error //resize the text rectangle doc.setTextRectangle({left:0, top:0, right:1000, bottom:1000}); } } </code></pre> <p>Result: <code>Error:doc.getTimeline().theLayer has no properties</code> </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload