Hi there!
I'm working on some stuff and I have to efficietly parse children of Layers. Because I got a lot of layers and children, I decided to store the children nodes into a parent array instead of having a loop through all layers available. (That may be inconsistent, just tell me if you have better idea ).
OK, to get you see, Here is the expected structure:
This structure is created by an action:
addLayer("Parent");
set( layer[%1].onclick, showSubItems );
for( set(i,0), i LT 2, inc(i),
txtadd(childName, "Child", get(i));
addLayer(get(childName)); set( layer[get(childName)].parent, layer["Parent"]);
copy( layer["Parent"].subItems[get(i)].item, layer[get(tagName)]);
);
Display More
This works like a charm.
The point is that the "showSubItem" action acts correctly with a direct "show" command:
<action name="showSubItem">
for( set(i, 0), i LT subItems.count, inc(i),
set( subItems[get(i)].item.alpha, 1.0 );
);
</action>
But when using a TWEEN command, it works ONLY for the items with index greater than 0... i.e. the first item (idx=0) does not show.
<action name="showSubItem">
for( set(i, 0), i LT subItems.count, inc(i),
tween( subItems[get(i)].item.alpha, 1.0, 3.0 );
);</action>
Note that I found a workarround by modifying the index reference (saying it's a nonsense, as the index will ever be 0-N, but anyway, there is here a black-magic trick):
addLayer("Parent");
set( layer[%1].onclick, showSubItems );
for( set(i,1), i LE 3, inc(i),
txtadd(childName, "Child", get(i));
addLayer(get(childName)); set( layer[get(childName)].parent, layer["Parent"]);
copy( layer["Parent"].subItems[get(i)].item, layer[get(tagName)]);
);
Display More
I guess it is something about item-array naming convention or somewhat...
Regards,
Paul