This works, 
  
  
import mx.transitions.Tween; 
import mx.transitions.easing.*; 
import flash.filters.GlowFilter; 
 
var gf:GlowFilter = new GlowFilter(0x356D83, 100, 5, 5, 5, 3, false, false);

for (var i = 0; i < 5; ++i) 
{ 
    var mc:MovieClip = this["kText" + i]; 
        mc.filters = [gf]; 
         
    mc.gfBX = new Tween(gf, "blurX", Elastic.easeOut, 5, 5, 1, true); 
    mc.gfBY = new Tween(gf, "blurY", Elastic.easeOut, 5, 5, 1, true); 
         
    mc.onRollOver = function() { 
                var _mc:MovieClip = this; 
        _mc.gfBX.continueTo(30, 2); 
        _mc.gfBX.onMotionChanged = function() { 
                _mc.filters = [gf]; 
        }; 
                
        _mc.gfBY.continueTo(30, 2); 
                _mc.gfBY.onMotionChanged = function() { 
                _mc.filters = [gf]; 
        }; 
    }; 
         
    mc.onRollOut = function() { 
                var _mc:MovieClip = this; 
        _mc.gfBX.continueTo(5, 2); 
        _mc.gfBX.onMotionChanged = function() { 
                _mc.filters = [gf]; 
        }; 
                 
        _mc.gfBY.continueTo(5, 2); 
                _mc.gfBY.onMotionChanged = function() { 
                _mc.filters = [gf]; 
        }; 
    }; 
         
} 


Did you have some other solution? 
 

-Keith 
http://home.mn.rr.com/keithreinfeld 
 


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Boon Chew
Sent: Wednesday, October 11, 2006 1:46 PM
To: Flashcoders mailing list
Subject: [Flashcoders] brain teaser: filter tweening code has a problem,can
you spot it?

Hi all,

I downloaded a piece of filter tweening code, modified it (added loop around
it) to tween mutiple clips on stage with the name (kText0, kText1, etc.) and
for some reason it only tweens the last clip.

After some debugging I found out where the problem lies.  But when I
compiled the code in my head, everything seemed fine (probably have a buggy
brain).  Can you spot what the problem is from the code below?  How would
you fix it?

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

for (var i = 0; i < 5; ++i)
{
    var mc = this["kText" + i];
    var gf:GlowFilter = new GlowFilter(0x356D83, 100, 5, 5, 5, 3, false,
false);
    var gfBX:Tween = new Tween(gf, "blurX", Elastic.easeOut, 5, 5, 1, true);
    var gfBY:Tween = new Tween(gf, "blurY", Elastic.easeOut, 5, 5, 1, true);
    mc.onRollOver = function() {
        gfBX.continueTo(30, 2);
        gfBY.continueTo(30, 2);
    };
    mc.onRollOut = function() {
        gfBX.continueTo(5, 2);
        gfBY.continueTo(5, 2);
    };

    gfBX.onMotionChanged = function() {
        mc.filters = [gf];
    };
}



_______________________________________________
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