Copy color from object to another

Hi. I’m trying to set a text object’s color to another text object’s color. I wrote this:

The first 3 lines behave like I expected–left’s color was changed to red, right’s text was changed from a “B” to an “A”, and right’s color was changed to green. I thought the 4th line would change right’s color to red (the color of left), following the syntax of line 2.

Thanks for any help.

No, what you’re doing there is changing the colour of right to the string “A” (you’re doing pretty much the same as action 2).

I don’t believe there is an event action to get the tint of an object, only one to set it. But you can do it with a small bit of JavaScript :

(my two text objects are OldText and NewText)

Ah, OK that makes sense that left.String() can’t represent two different things. I don’t know Javascript but your example looks fairly straightforward so I’ll give that a try. Thanks!

If you don’t need to dynamically access the color, you can use something like this:

Color Changing 2

Color Changing 3

1 Like

Thanks for this example, it’s very helpful. I was able to use this idea to use an array of colors that I could match up the values with the object variables.

1 Like