Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

Relative Stacking order of Sub Layers and items

$
0
0

I want to get the items in a layer sorted in their stacking order (including any sub-layers).

For example:

 

Layer 1

   item A

   Layer 1a

   Group B

   item C

 

In the example above, I would get back an array like this:

[item A, layer 1a, Group B, item C]

Of course, you'd think this is a simple enough thing given that zOrderPosition is freely available:

 

function getChildrenInStackingOrder(layer){

    var sublayers=layer.layers;

    var pageItems=layer.pageItems;

    var result=new Array ();

    var size=sublayers.length+pageItems.length;

 

    for(var i=0;i<sublayers.length;i++){

       result[sublayers[i].zOrderPosition]=sublayers[i];  <<<----------- ERROR

    }

 

    for(var i=0;i<pageItems.length;i++){

       result[pageItems[i].zOrderPosition]=pageItems[i];

    }

 

    return result;

}

 

My problem is that AI CS4 throws up at the line marked above with a message "Internal Error 1200". I'm guessing that it's illegal to get the zOrderPosition of a sublayer.  Any thoughts?

 

Anurag.

 

PS. Do any Adobe engineers read this forum at all? Seems like there's a lot of internal documentation that could help in answering some of our questions.


Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>