"parent" does not behave the way one would expect

#1

I have the code console.log(parent); on a frame script in the timeline of a Clip called animation. It returns itself:

image

I would expect it to return its parent Clip, Menu. If the Clip is on the root timeline, I’d expect it to return root.

EDIT: did some more research…
parent.parent returns a frame:
image

parent.parent.parent returns a layer in Menu called Stuff, which is where animation is.
parent.parent.parent.parent returns a timeline.
image image

I’m pretty sure the ability to refer to frames through code is an intended feature rather than a bug. Referring to layers could also be helpful, like if you’re checking its name or if layers ever gain the ability to change opacity. I can’t see a use case for referring to timelines as opposed to Clips, though.

I think parentClip and parentFrame (and parentLayer if that exists) should be in the API in place of parent, since those features are more clear.

0 Likes