Make my mouse shine script

Make my mouse shine script
Make my mouse shine script

Make my mouse shine script Just a free actionscript 3 classes I have made for fun :giggle: ________________ CODE _______________________ package { import flash.display.Sprite; import flash.display.MovieClip; import flash.events.*; import flash.filters.BlurFilter; [SWF(frameRate=»30″, backgroundColor=»#000000″)] public class MouseEfect extends Sprite { private var _ar_obj:Array = new Array(); private var _boolMouse:Boolean; public function MouseEfect () { _ar_obj = new Array(); _boolMouse = true; stage.addEventListener(Event.MOUSE_LEAVE, stageOut); stage.addEventListener(MouseEvent.MOUSE_MOVE, stageOver); this.addEventListener(Event.ENTER_FRAME, enter_f); } public function stageOver(me:MouseEvent):void { _boolMouse = true; } public function stageOut(e:Event):void { _boolMouse = false; } public function enter_f(e:Event):void { if(_boolMouse) { createClassObject(); } for(var i:int = 0 ; i < _ar_obj.length ; i++) { _ar_obj[i]["_obj"].alpha -= 0.04; _ar_obj[i]["_obj"].y -= _ar_obj[i]["_cptY"]; _ar_obj[i]["_obj"].x -= _ar_obj[i]["_cptX"]; var blur:BlurFilter = new BlurFilter(_ar_obj[i]["_blur"] , _ar_obj[i]["_blur"], 3); _ar_obj[i]["_obj"].filters = [ blur ]; _ar_obj[i]["_cptX"] = Math.random() * 2 – 1; _ar_obj[i]["_cptY"] += _ar_obj[i]["_cptY"] / 40; if(_ar_obj[i]["_alpha"] <= 0) { _ar_obj.slice(_ar_obj[i]["_position"], _ar_obj[i]["_position"] + 1); this.setChildIndex(_ar_obj[i]["_obj"], 0); this.removeChildAt(0); } } } // public function createClassObject():void { // creat a sprite and add it to the output var particule:Sprite = new Sprite(); particule.graphics.beginFill(0xFFFFFF); var r_x:int = Math.random() * 15 – 4; var r_y:int = Math.random() * 20; var r_w:int = Math.random() * 2 + 1; var r_h:int = Math.random() * 2 + 1; particule.graphics.drawRect(this.mouseX + r_x, this.mouseY + r_y, r_w, r_h); // add the sprite to the an Object var objComplex:Object = {_obj:particule, _cptY:1, _cptX:0, _blur:1, _position:_ar_obj.length}; // add to the scene this.addChild(objComplex["_obj"]); _ar_obj.push(objComplex); } } } ________________________________________ _____ See the code and result on my "wonderfl" account here [link]

Categories and tags of the game : Demonstration, Interactive, Mouse-only, Single Player, Toy