[Flashcoders] Dynamically setting color and adding a glow [Flash 8 AS2]

2009-05-20 Thread Paul Steven
I am trying to dynamically set the color and apply a glow to a movie clip as 
follows however one seems to overwrite the other. Anyone know why this is not 
working and how to fix it? My code is as follows:


function setGameBackgroundColourAndGlow(passedHexColour:Number):Void {

var objTileColor = new Color(gameBgMC);
objTileColor.setRGB(passedHexColour);

var myGlowFilter:GlowFilter = new GlowFilter ();

myGlowFilter.color = 0x003366;  
myGlowFilter.blurX = 10;
myGlowFilter.blurY = 10;
myGlowFilter.strength = 0.6;
myGlowFilter.quality = 3;   
myGlowFilter.inner = true;  
myGlowFilter.knockout = false;  

gameBgMC.filters = [myGlowFilter];  

}


___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


RE: [Flashcoders] Dynamically setting color and adding a glow [Flash 8 AS2]

2009-05-20 Thread Jack Doyle
The color transform (setRGB()) affects the entire MovieClip including all 
filters. There are two options that come to mind that would accomplish what 
you're after:

1) Wrap your objTileColor MovieClip in another MovieClip. Then you can 
tint/color the inner clip and apply the glow to the wrapper.

2) Use a ColorMatrixFilter instead of setRGB(). This may not give you exactly 
the same effect and it's a bit more difficult to work with, but it does allow 
you to alter the color without affecting the glow (just make sure you stack the 
effects in the proper order)

Personally, option #1 seems the easiest/cleanest.

Jack

-Original Message-
From: Paul Steven [mailto:paul_ste...@btinternet.com] 
Sent: Wednesday, May 20, 2009 6:36 AM
To: 'Flash Coders List'
Subject: [Flashcoders] Dynamically setting color and adding a glow [Flash 8 AS2]

I am trying to dynamically set the color and apply a glow to a movie clip as 
follows however one seems to overwrite the other. Anyone know why this is not 
working and how to fix it? My code is as follows:


function setGameBackgroundColourAndGlow(passedHexColour:Number):Void {

var objTileColor = new Color(gameBgMC);
objTileColor.setRGB(passedHexColour);

var myGlowFilter:GlowFilter = new GlowFilter ();

myGlowFilter.color = 0x003366;  
myGlowFilter.blurX = 10;
myGlowFilter.blurY = 10;
myGlowFilter.strength = 0.6;
myGlowFilter.quality = 3;   
myGlowFilter.inner = true;  
myGlowFilter.knockout = false;  

gameBgMC.filters = [myGlowFilter];  

}






___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders