DC child component
-
hi
i have just started experimenting with dc, and i have a quick question.
i have a group - "char", that contains two groups "seat", "legs".
i have added a onClick behavior that i would like to hide / show the legs (just for testing).
i thought i could do something like legs.SET("hidden", 0, 1), but that gives an error.
i can ad the onclick behavior direct at the "legs", but when they are hidden, i can't click to show them again - so i thought the solution could be to add the behavior to the parent.
is it possible to access childs from the main group?
thanks
jorgensen -
create an attribute say called hide in the parent and give it a value 0, toggle this via the onClick with SET("hide", 0, 1).
Then for hidden attribute value within the children(legs)
hidden = parent!hide (or char!hide)
-
-
hi pcmoor
thank you very much for your fast reply.
i have opened your file and it works just fine!
i have tried to replicate the same behavior to my own model, but i can't get it to work - though it seems that i have done exactly the same.
could i ask you to test the file? it might just be a typeping error
-
hav't an explanation to why example 2 does not work, however able to fix using example 1
will look into it tomorrow
-
the difference between my examples (hide.skp) and your model (save.skp) is the parent is a component in mine whereas yours is a group. It appears groups can't pass down a value, but rather they need to reference the parent.
Advertisement