Letter A with onClick material colours

Letter A with onClick material colours

Postby SJS66 » Wed Dec 13, 2017 8:51 am

What would be the best way to make a sub-component (A_Letter) that changes it's colour from Black to Red while it it is inside a main component (A_Card) with onClick attributes? So you onClick on the A_Card component and the A_Letter subcomponent changes colour. I have included two colour swatches on the back of the A_Card so "Black_L" & "Red_L" materials are in model.

I've attached a SU 2017 model for anyone to play with if they could be bothered. Otherwise instructions, a link or eg. file would suffice.

I'm sure it is relatively simple, starting to think the same about me. :-P
0
User avatar
SJS66 
Premium Member
Premium Member
 

Re: Letter A with onClick material colours

Postby pcmoor » Wed Dec 13, 2017 10:23 am

card trick.skp


I choose generic red and black, rather than add a pallet, use SET("attribute",state1,state2,...stateN) for onClick in parent and reference the child material, named colors have to be text.

http://ruby.sketchup.com/Sketchup/Color.html
lists the standard colors that DCs (ruby) interprets


P.S.
I removed your existing materials replaced with default
0

pcmoor 
 

Re: Letter A with onClick material colours

Postby SJS66 » Thu Dec 14, 2017 7:41 am

Thanks again pcmoor, nice "card trick":-)

What I can't figure out is why you need the Custom "f" attribute in the child component attributes? How does that work when it has no values & is not referenced by the parent component attributes?
0
User avatar
SJS66 
Premium Member
Premium Member
 

Re: Letter A with onClick material colours

Postby pcmoor » Thu Dec 14, 2017 11:59 am

a bit of junk, sorry can be deleted, can't recall why I started it.....sign of age?
1

pcmoor 
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Dynamic Components

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Visit our sponsors: