# Subclassing/extending ColorTransform?

**URL:** <https://forum.kirupa.com/t/subclassing-extending-colortransform/244595>\
**Category:** flash\
**Created:** [November 20, 2007, 1:12am UTC](https://forum.kirupa.com/t/subclassing-extending-colortransform/244595 "2007-11-20T01:12:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stickeroo](https://avatars.discourse-cdn.com/v4/letter/s/e19adc/32.png) [@Stickeroo](https://forum.kirupa.com/u/Stickeroo)\
**Post date:** [November 20, 2007, 1:12am UTC](https://forum.kirupa.com/t/subclassing-extending-colortransform/244595/1 "2007-11-20T01:12:25Z")

</div>

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:

```auto
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:

```auto
mySprite.transform.colorTransform=new ColorTransform(...);

```

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:

```auto
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!
