I’ve written a class that allows me to convert HSL values to their RGB equivalents. It all works like it should, but I’m curious.
Currently, I have to call a getter function to have the “HSLColorTransform” applied to my display object…here’s an example:
var myHSLColorTransform:HSLColorTransform=new HSLColorTransform(hue, saturation, luminance); mySprite.transform.colorTransform=myHSLColorTransform.colorTransform;
(I stole an idea from the Transform class and named my getter “colorTransform” because I clearly hate myself and want more trouble down the road, but it works for now…)
My question is this: Is there anyway to have a class that extends ColorTransform (like my HSLColorTransform) “return” its modified ColorTransform without having to use some other method? F’rinstance, were I just to use a normal ColorTransform object, if I wrote:
I’d see mySprite’s color transformed accordingly. I know constructors can’t return values, but there has to be something relatively simple that I’m missing in order to be able to just use this:
mySprite.transform.colorTransform=new HSLColorTransform(h, s, l);
without having to call some subsequent method in order to see it applied?
Clear as mud? I’d greatly appreciate any insight. Like I said, it works as-is, but I think it could be more elegant. Thanks in advance!