12-08-2005, 07:35 PM
|
#1
|
|
Registered User
Join Date: Dec 2005
Posts: 4
|
flash.filters.GlowFilter
hey,
I made this simple glow effect on a mc called glow_mc.
this is the action script:
import flash.filters.GlowFilter;
var gf:GlowFilter = new GlowFilter(0xfffff1, 100, 1, 3, 5, 3, false, false);
glow_mc.filters = [gf];
glow_mc.onEnterFrame = function() {
this.onEnterFrame = function() {
if (gf.blurX <20) {
gf.blurX++;
gf.blurY++;
} else {
delete this.onEnterFrame;
}
glow_mc.filters = [gf];
};
};
my question is, how can i make the glow fade (reduce blur) after it reaches the full blur (20)
a stobing effect is what I am going for...does anyone follow here? help!
|
|
|
12-08-2005, 07:56 PM
|
#2
|
|
GenCode
Join Date: Dec 2005
Posts: 10
|
how about a Boolean? that sets to 1 when gf.blur reaches 20.
if(boolean == false){
if (gf.blurX <20) {
gf.blurX++;
gf.blurY++;
} else {
boolean = true;
}else if (boolean == true){
if (gf.blurX >15) {
gf.blurX--;
gf.blurY--;
}else{
delete this.onEnterFrame;
}
|
|
|
12-08-2005, 08:33 PM
|
#3
|
|
Registered User
Join Date: Dec 2005
Posts: 4
|
well, i couldnt get what you suggested to work exactly, probably just because I couldnt adapt it quite right..anyways here's where I have taken it, i think I am getting closer to the right idea but still not quite there...help?
import flash.filters.GlowFilter;
var zee
var gf:GlowFilter = new GlowFilter(0xfffff1, 100, 1, 3, 5, 3, false, false);
glow_mc.filters = [gf];
glow_mc.onEnterFrame = function() {
if(gf.blurX==1) {
zee = false;
}
if(zee == false){
if (gf.blurX <20) {trace(zee);
gf.blurX++;
gf.blurY++;
}else {
delete this.onEnterFrame;
}
}
if(gf.blurX==20) {
zee = true;
}
if (zee == true){trace(zee);
if (gf.blurX >1) {
gf.blurX--;
gf.blurY--;
}else {
delete this.onEnterFrame;
}
}
}
I actually dont really get why this doesnt work..when i do the trace it says
true
true
true
false
false
false etc...so its switching back and forth, its just not doing what its supposed to when zee= true or false
|
|
|
12-08-2005, 08:59 PM
|
#4
|
|
Registered User
Join Date: Dec 2005
Posts: 4
|
ok i kinda got it, it works but it doesnt look quite as smooth as it should...any further suggestions?
import flash.filters.GlowFilter;
var zee
var gf:GlowFilter = new GlowFilter(0xfffff1, 50, 1, 3, 5, 3, false, false);
glow_mc.filters = [gf];
glow_mc.onEnterFrame = function() {
if(gf.blurX==1) {
zee = false;
}
if(zee == false && gf.blurX <50) {
gf.blurX++;
gf.blurY++;
trace(gf.blurX)
}
glow_mc.filters = [gf];
if(gf.blurX==50) {
zee = true;
}
if (zee == true && gf.blurX >1) {
gf.blurX--;
gf.blurY--;
trace(gf.blurX)
}
glow_mc.filters = [gf];
}
|
|
|
12-08-2005, 10:33 PM
|
#5
|
|
is my last name...
Join Date: May 2004
Posts: 1,051
|
Use the tween class with filters, much easier to do, and you can achieve more effects:
ActionScript Code:
import flash.filters.GlowFilter;
import mx.transitions.Tween;
import mx.transitions.easing.Regular;
glow_mc.glow = 0;
var tween_glow:Tween = new Tween(glow_mc, "glow", Regular.easeOut, 0, 20, 1, true);
tween_glow.onMotionChanged = function()
{
var gf:GlowFilter = new GlowFilter(0xFFFFF1, 100, this.obj.glow, this.obj.glow, 5, 3, false, false);
var filter:Array = new Array(gf);
this.obj.filters = filter;
};
tween_glow.onMotionFinished = function()
{
this.yoyo();
};
__________________
Anything is possible with Flash, it's just a matter of inventing the possibilities
Certified Swfwizard
|
|
|
01-01-2006, 07:29 PM
|
#6
|
|
Registered User
Join Date: Jan 2006
Posts: 1
|
try to use the filter managing prototypes (FMP) www.flash-fmp.de additionally!
it really simplifies tweening issues with filters a lot, since it converts all filterproperties
to "native" movieclip properties ( similar to e.g. _x, _y or _alpha )
|
|
|
07-27-2007, 11:13 AM
|
#7
|
|
Member
Join Date: Dec 2005
Location: London, UK
Posts: 52
|
stop function?
ActionScript Code:
import flash.filters.GlowFilter;
import mx.transitions.Tween;
import mx.transitions.easing.Regular;
glow_mc.glow = 0;
var tween_glow:Tween = new Tween(glow_mc, "glow", Regular.easeOut, 0, 20, 1, true);
tween_glow.onMotionChanged = function()
{
var gf:GlowFilter = new GlowFilter(0xFFFFF1, 100, this.obj.glow, this.obj.glow, 5, 3, false, false);
var filter:Array = new Array(gf);
this.obj.filters = filter;
};
tween_glow.onMotionFinished = function()
{
this.yoyo();
};
This works great, but how do you stop this function ?
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 02:53 PM.
///
|
|