0 Replies Latest reply on Jan 26, 2011 1:21 PM by SuperMacGuy

    [AS CS5] Sorting out multiple nested objects

    SuperMacGuy Level 2

      I have documents where we have labelled frames for scripting. Some of our artist have pasted these labelled frames inside of duplicates of the original labelled frame, or they have group multiple objects, and pasted then into (using **paste into) the labelled box.

      This is giving me a big headache when I run the script.


      What I have in the document is like this:

      Labelled Box < Labelled Box (inside)


      Labelled Box < group (inside) < Labelled Box1, Labelled Box2 (inside)


      Labelled Box1, Labelled Box2 (not grouped, not inside of anything else, just 2 instances)


      I am trying to get every page item of all page items whose label is "theLabel". This has the result of returning me a list of 2 or more items. If the box has boxes pasted into, I only need the top level item. If there is a group and sub items, I still only want the top object. In the last instance, since there are no items pasted into, I want the top level items, and this can be 2 or more items.


      Is there a way of trying to see if one item is inside of one another? I can see that every item has a parent item, and the parent of example 1 is the frame. So I could ask one frame if its parent is the other one, and filter one out of my selection. The parent of each sub-item of example 2 is the group, not the main frame, and I can't seem to see how to ask if a group is inside of another frame. Since my return value on "every object whose label is..." returns items, not a group, how do I find out what the parent is? I tried to coerce a parent value to a string in order to just do some string comparisons but that didn't seem to work.