[FONT=Calibri][FONT=Verdana][SIZE=2]Hi,[/SIZE][/FONT][/FONT]
[FONT=Calibri]
[SIZE=2][FONT=Calibri]I bought this class but unfortunately there is no support. The class creates a shock effect which plays all the time. It works attaching the class directly to a movieClip that has another movieClip inside with an instance name of “logo_mc” but as I said it plays all the time and I would like to be able to stop it or replay it with eventListeners or to play only when the movieClip is mouse over (ROLL_OVER) and use it for buttons. [/FONT][/SIZE][/FONT]
[FONT=Calibri]
[SIZE=2][FONT=Calibri]Can someone be so kind and gave me some direction on how to do this?[/FONT][/SIZE][/FONT]
[FONT=Calibri]
[SIZE=2][FONT=Calibri]Thanks,[/FONT][/SIZE]
[SIZE=2][FONT=Calibri]Fs_tigre[/FONT][/SIZE]
[/FONT]
package {
import flash.filters.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.display.*;
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.printing.*;
import flash.system.*;
import flash.text.*;
import flash.ui.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class shock extends MovieClip {
[COLOR=#993300] public[/COLOR] [COLOR=#993300]var[/COLOR] electricLogo:[COLOR=#993300]MovieClip[/COLOR];
public function shock(){
addFrameScript(0, frame1);
}
public function removeFX(mc:MovieClip):void{
mc.original.filters = [];
mc.removeEventListener("enterFrame", mc.listener);
mc.bitmap1.dispose();
mc.bitmap2.dispose();
this.removeChild(mc);
}
function frame1(){
electricLogo = setSpark(logo_mc);
}
public function setSpark(mc:MovieClip):MovieClip{
var bounds:* = null;
var offset_y:* = NaN;
var offset_x:* = NaN;
var w:* = NaN;
var h:* = NaN;
var clip:* = undefined;
var holder:* = null;
var SparkMC:* = null;
var glow:* = null;
var glow2:* = null;
var glow3:* = null;
var bitmap:* = null;
var SparkBitmap:* = null;
var offset:* = undefined;
var yOff:* = undefined;
var xOff:* = undefined;
var offsets:* = undefined;
var i:* = undefined;
var seed:* = undefined;
var disp:* = null;
var p:* = undefined;
var redraw:* = undefined;
var mc:* = mc;
bounds = mc.getBounds(mc);
offset_y = 20;
offset_x = 20;
w = (bounds.width + offset_x);
h = (bounds.height + offset_y);
bounds.x = (bounds.x - (offset_x / 2));
bounds.y = (bounds.y - (offset_y / 2));
clip = new MovieClip();
holder = new MovieClip();
this.addChild(clip);
clip.addChild(holder);
clip.name = ("Spark" + this.getChildIndex(clip));
SparkMC = new Bitmap();
glow = new GlowFilter(0xFFFF, 1, 1, 1, 100, 1, false, true);
glow2 = new GlowFilter(0xFFFF, 0.6, 8, 8, 2, 1, false, false);
glow3 = new GlowFilter(6711039, 0.8, 10, 10, 3, 1, false, false);
bitmap = new BitmapData(w, h, true, 0);
SparkBitmap = new BitmapData(w, h, true, 0);
bitmap.draw(mc, new Matrix(1, 0, 0, 1, (bounds.x * -1), (bounds.y * -1)));
holder.x = bounds.x;
holder.y = bounds.y;
clip.x = mc.x;
clip.y = mc.y;
SparkMC.bitmapData = SparkBitmap;
holder.addChild(SparkMC);
offset = new Point(0, 0);
yOff = 2;
xOff = 2;
offsets = new Array();
i = 0;
while (i < 4) {
offsets.push(new Point());
i = (i + 1);
};
seed = Math.round((Math.random() * 300));
disp = new BitmapData(w, h);
p = new Point();
redraw = function ():void{
var mc:*;
var mapFilter:DisplacementMapFilter;
for each (mc in offsets) {
mc.y = (mc.y + yOff);
mc.x = (mc.x - xOff);
};
disp.perlinNoise(10, 20, 3, seed, true, true, 1, true, offsets);
mapFilter = new DisplacementMapFilter(disp, offset, 1, 1, 25, 25, "color");
SparkBitmap.applyFilter(bitmap, bitmap.rect, p, glow);
SparkBitmap.applyFilter(SparkBitmap, bitmap.rect, p, mapFilter);
};
mc.filters = [glow2];
holder.blendMode = "screen";
holder.filters = [glow2, glow3];
clip.addEventListener("enterFrame", redraw);
clip.bitmap1 = SparkBitmap;
clip.bitmap2 = disp;
clip.listener = redraw;
clip.original = mc;
return (clip);
}
}
}