Hi guys,
I’m not new to kirupa, or the kirupa forums, but it’s been a while since I posted, and my old username has been lost somewhere in time. I am, new to AS3, however, and I was hoping I could get a little help with this problem?
I have a default stage size, flash cs4, with a small 6x6 circle in the library, exported for actionscript, in frame 1, with the name of ‘glower’.
There’s only 1 frame, and the actions are:
import flash.filters.BlurFilter;
var GlowF:BlurFilter = new BlurFilter();
GlowF.blurX = 10;
GlowF.blurY = 10;
GlowF.quality = 1;
/*
function RunBG(){
    stage.addEventListener(Event.ENTER_FRAME, AddGlow);
};
RunBG();
*/
function AddGlow():void{
    //for(var x=0; x<1; x++){
        var newGlow:glower = new glower();
        this.addChild(newGlow);
    
        newGlow.x = 0;
        newGlow.y = Math.random()*stage.stageHeight;
        newGlow.width = 20;
        newGlow.height = 20;
    
        newGlow.filters = [GlowF];
    
        newGlow.addEventListener(Event.ENTER_FRAME, GlowAnimate);
    
    //}
}
var count:int = 0;
function GlowAnimate(e:Event):void{
    
    var Glow:MovieClip = MovieClip(e.target);
    
    //Glow.filters.blurX += 1;
    //Glow.filters.blurY += 1;
    Glow.width -= 1;
    Glow.height -= 1;
    
    var newGlow:glower = new glower();
    
    newGlow.x = Glow.x+Math.random()*20;
    newGlow.y = Glow.y;
    newGlow.width = 10;
    newGlow.height = 10;
    newGlow.filters = [GlowF];
    
    if(count < 200){
        stage.addChild(newGlow);
    }
    
    newGlow.addEventListener(Event.ENTER_FRAME, GlowAnimate); 
    count++;
    if(Glow.width <= 0){
        Glow.removeEventListener(Event.ENTER_FRAME, GlowAnimate);
        Glow = null;
    }
    
}
AddGlow();
There are a few things I wrote, which I’ve commented out and may decide to use later. Probably not, trial and error can only get me so far.
Eventually, I’d like to have a random movement across the page, but as it stands now, it goes from right to left, a very short distance. It seems to be using a lot of CPU. Is there a better way to do this? Am I going about this the wrong way?
Thanks for any help
x x