PDA

View Full Version : stobe effect and playing multiple clips



luthan
December 4th, 2003, 03:10 AM
i just started learning to work with actionscript so im not that good

i have 5 movieclips on the bottom on the site im trying to make
i want them to blink in order first clip to th eother.
so when the first one is done blinking i want the other one to do so, and so on untill they are all done

this is the code i got for strobe like effect, but im not sure how to use it with multiple clips so they dont all do that effect at the same time

the code iis


cir.step = 0;
cir.seconds = 1;
cir.framespersecond = 30;
cir.f = 0;
cir.strobe = [0, 100, 10, 30];
cir.onEnterFrame = function() {
this._alpha = this.strobe[this.step];
this.step += 1;
this.f += 1;
if (this.step == this.strobe.length) this.step = 0;
if (this.f == this.framespersecond*this.seconds) {

delete this.onEnterFrame;
}
};


thanks for the help

JustinM
December 4th, 2003, 11:05 AM
If you post the .fla I'd like to give it a shot.

luthan
December 4th, 2003, 11:33 AM
here is the fla with the code
as u can see i have all that code for each clip and i messed with the second values to get the effect that i wanted.
but its really ghetto so im sure there is another way of doing this its just that im not that good yet

thanks for the help

JustinM
December 4th, 2003, 02:38 PM
alright man, I don't really have the time right now to complete this but here you go. I created a prototype that contains the strobing functionality. To call the prototype the syntax is cir.blink(seconds parameter); cir2.blink(...), you get the idea. This may not be the best way to do it but I think it's an improvement.

_root.movie.loadMovie("home.swf");
cir._visible = false;
cir2._visible = false;
cir3._visible = false;
cir4._visible = false;
cir5._visible = false;

//I created a prototype to perform the blinking,
// x is the parameter for seconds to blink

MovieClip.prototype.blink = function (x) {
this._visible = true;
this.step = 0;
this.framespersecond = 30;
this.seconds = x;
this.f = 0;
this.strobe = [0, 100, 10, 30];
this.onEnterFrame = function(){
this._alpha = this.strobe[this.step];
this.step += 1;
this.f += 1;
if (this.step == this.strobe.length){
this.step = 0;
};
if (this.f == this.framespersecond * this.seconds) {
delete this.onEnterFrame;
//this is where you need to increment the next cir mc
//to blink - also alter the value 2 to change seconds
//you'll want to automate the cir2, cir3 incrementation
cir2.blink(x * 2);
}
}
}
//call the prototype
cir.blink(.2);

Hope this helps! Maybe someone will chime in with a better solution

luthan
December 4th, 2003, 04:10 PM
hey man thanks for the effort

apreciate it :)