Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > ActionScript Forums Group > ActionScript 2.0

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-08-2005, 07:35 PM   #1
zee644
Registered User
 
Join Date: Dec 2005
Posts: 4
Default 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!
zee644 is offline   Reply With Quote
Old 12-08-2005, 07:56 PM   #2
GenCode
GenCode
 
Join Date: Dec 2005
Posts: 10
Default

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;
}
GenCode is offline   Reply With Quote
Old 12-08-2005, 08:33 PM   #3
zee644
Registered User
 
Join Date: Dec 2005
Posts: 4
Default

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
zee644 is offline   Reply With Quote
Old 12-08-2005, 08:59 PM   #4
zee644
Registered User
 
Join Date: Dec 2005
Posts: 4
Default

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];
}
zee644 is offline   Reply With Quote
Old 12-08-2005, 10:33 PM   #5
madgett
is my last name...
 
Join Date: May 2004
Posts: 1,051
Default

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
madgett is offline   Reply With Quote
Old 01-01-2006, 07:29 PM   #6
dr.macromed-swf
Registered User
 
Join Date: Jan 2006
Posts: 1
Default

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 )
dr.macromed-swf is offline   Reply With Quote
Old 07-27-2007, 11:13 AM   #7
midaspider
Member
 
midaspider's Avatar
 
Join Date: Dec 2005
Location: London, UK
Posts: 52
Question 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 ?
midaspider is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:13 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.