Adding colors to labels constructor?
Adding colors to labels constructor?
I think it would be useful if we could set the default label color at creation - ie, supply the r,g,b and a args to the table.
Re: Adding colors to labels constructor?
You can.
does the trick. Any parameter that's specified in the constraints table will be copied over to the new object. So you could have arbitrary values in there that you want the new label/console/whatever to also contain - the power of prototyping! Anyway, specific things like backgroundColor and such that constructors are aware of are (should be) applied by the constructor at creation time.
Re: Adding colors to labels constructor?
Hm, that doesn't quite work out -
isn't the same as
Namely, without the explicit call my label stack dissapears so something is going wrong.
Re: Adding colors to labels constructor?
I think the problem is coming from the fact that currently backgroundColor doesn't contain alpha information - that is stored in backgroundAlpha, so you'd need to add it explicitly like
As is, you're creating a totally opaque black label because the a=0 in backgroundColor is just being ignored , which causes the underlying image to appear to disappear.
Re: Adding colors to labels constructor?
Ah yes, that did it. Thanks.