fl.findObjectInDocByType()
で返された情報を使用できないようですfl.getDocumentDOM().selection
。
document.setTextRectangle
を使用して生成された配列からいくつかのテキストフィールドのサイズを変更するために使用したいと思いますfl.findObjectInDocByType()
。
すべてのtextObjectプロパティに簡単にアクセスできますがdocument.setTextRectangle
、現在の選択が必要なため、途方に暮れています。
選択を設定するためのドキュメントの例は次のとおりです。
fl.getDocumentDOM().selection = fl.getDocumentDOM().getTimeline().layers[0].frames[0].elements[0];
fl.findObjectInDocByType()
属性を持つオブジェクトの配列を返します:(object.timeline
、、、、)object.layer
object.frame
object.parent
fl.getDocumentDOM().selection=
ただし、これらはオブジェクトであり、 ...で必要な配列インデックス番号のプロパティはありません。
var doc = fl.getDocumentDOM();
var textFieldArray = fl.findObjectInDocByType("text", doc);
for (var i=0; i < 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});
}
}
結果:Error:doc.getTimeline().theLayer has no properties