Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Images in a multistateobject

I want to change the position of a picture located within a multistate object.

I have joined two rectangles (one of which contains a placed bitmap) to form a multistate object together. But now I can't address these rectangles as rectangles anymore, only as pageitems. So:

app.activeDocument.multiStateObjects[0].states[0].rectangles.length

gives 0.

while

app.activeDocument.multiStateObjects[0].states[0].pageItems.length

gives 1.

Since I can't address the picture frame as a rectangle anymore, I can't do anything with the picture it contains... (I would like to apply the fit function on it: myFrame.fit(FitOptions.CONTENT_TO_FRAME), but then myFrame should be a rectangle, not just a pageItem)

like image 238
Joop de Groot Avatar asked Dec 06 '25 07:12

Joop de Groot


1 Answers

The pageItem is most likely a group. When you create a multistateObject, it creates groups for each state and these groups become the parents of the pageItens you had. So you should be able to access your rectangles like this:

app.activeDocument.multiStateObjects[0].states[0].groups[0].rectangles
like image 110
Julien Grégoire Avatar answered Dec 09 '25 16:12

Julien Grégoire



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!