Sorry, my post got cut off (firefox on mac bug)

here's the rest of the code:

         private function getRGBArray(hex:Number):Array
         {
                 // get red by shifting hex effectively rounding it down
                 var r = (hex>>16);
                 var remains = hex - (r<<16);
                 // get green by shifting the red-remains
                 var g = (remains>>8);
                 // get green by subtracting the greenvalue from the
red-remains
                 var b = remains - (g<<8);
                 return [r,g,b];
         }

         private function onTweenEnd(t:TweenEvent):void
         {
             //null
         }
         // define update function
         private function onTweenUpdate(t:TweenEvent):void
         {
                 var o:Object = (t.target as
SmartTextInput).getStyle('backgroundColor');
                 var a:Array = getRGBArray((o as Number));
                 // c is an [r,g,b]-array
                 // shift the values to position and add them to get the
color value.
                 var c:ColorTransform = new
ColorTransform(((a[0]+1)<<16)+((a[1]+1)<<8)+(a[2]+1));
                    (t.target as
SmartTextInput).setStyle('backgroundColor', c);
         }


Do I need to be extending TweenEffect and using that? Or, do I need to
be extending Tween? I'm a little confused how these work beyond the
simple mxml examples in the docs.


--- In [email protected], "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Have you tried using mx.effects.TweenEffect?  If you wanted to only
> use mxml, this could be done by making a component that has two
> states; TextInput backgoundColor 1 & 2.  Inside of the component,
> add a transition effect (Tween) that occurs when the component
> changes state.
>
> -TH
>
> --- In [email protected], "joshuajnoble" jnoble@ wrote:
> >
> > I'm trying to create an effect that changes the background color
> of my
> > TextInput. I've tried using AnimateProperties with isStyle and
> > 'backgroundColor' but that produced a psychedelic freakout,
> probably
> > because the effect is trying to take hex values and turn them to
> ints.
> > I can write something that might work by subclassing the
> > AnimateProperties and turning all those hex values to decimals and
> > then back again. But before I start down that path:
> > 1. does anyone know of an easier/faster way to do this and if not,
> > 2. does anyone think that my plan of coverting hex to int and then
> > back will or will not work?
> > Thanks in advance for any ideas/thoughts.
> >
>






--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to