Much cleaner, although you have a lot of this references that are
redundant.

import mx.transitions.Tween;
import mx.transitions.easing.*;
import flash.filters.GlowFilter;
import mx.utils.Delegate;

class GlowClip extends MovieClip {
         private var glowTween:Tween;
         private var glowVal:Number = 5;

        function GlowClip() {
                var gf = new GlowFilter(0x356D83, 100, 5, 5, 5, 3,
false, false);
                filters = [gf];
                glowTween = new Tween(this, "glowVal", Elastic.easeOut,
glowVal, glowVal, 1, true);
                glowTween.onMotionChanged = Delegate.create(this,
tweenChanged);
                glowTween.stop();
        }
        function onRollOver() {
                glowTween.continueTo(30, 2);
        }
        function onRollOut() {
                glowTween.continueTo(5, 2);
        }
        private function tweenChanged(tw, newVal) {
                var gf = new GlowFilter(0x356D83, 100, newVal, newVal,
5, 3, false, false);
                filters = [gf];
        }
}


BLITZ | Steven Sacks - 310-551-0200 x209


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:flashcoders-
> [EMAIL PROTECTED] On Behalf Of Muzak
> Sent: Wednesday, October 11, 2006 4:30 PM
> To: Flashcoders mailing list
> Subject: Re: [Flashcoders] brain teaser: filter tweening code has a
> problem,can you spot it?
> 
> arghh, changed a variable name at the end and forgot to change it
> somewhere else in the code.
> 
> working version ;-)
> 
> import mx.transitions.Tween;
> import mx.transitions.easing.*;
> import flash.filters.GlowFilter;
> import mx.utils.Delegate;
> 
> class GlowClip extends MovieClip {
>  private var glowTween:Tween;
>  private var glowVal:Number = 5;
>  //
>  function GlowClip() {
>   var gf = new GlowFilter(0x356D83, 100, 5, 5, 5, 3, false, false);
>   this.filters = [gf];
>   this.glowTween = new Tween(this, "glowVal", Elastic.easeOut,
glowVal,
> glowVal, 1, true);
>   this.glowTween.onMotionChanged = Delegate.create(this,
> this.tweenChanged);
>   this.glowTween.stop();
>  }
>  //
>  function onRollOver() {
>   this.glowTween.continueTo(30, 2);
>  }
>  //
>  function onRollOut() {
>   this.glowTween.continueTo(5, 2);
>  }
>  //
>  private function tweenChanged(tw, newVal) {
>   var gf = new GlowFilter(0x356D83, 100, newVal, newVal, 5, 3, false,
> false);
>   filters = [gf];
>  }
> }
> 
> regards,
> Muzak
> 
> 
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> 
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training
> http://www.figleaf.com
> http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to