HOME | DD

MixedMilkChOcOlate — Make my mouse shine script

Published: 2009-08-24 20:01:17 +0000 UTC; Views: 7227; Favourites: 156; Downloads: 155
Redirect to original
Description Just a free actionscript 3 classes I have made for fun

________________ 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 _boolMouseoolean;

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 blurlurFilter = 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 objComplexbject = {_objarticule, _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]
Related content
Comments: 108

SparklyDest In reply to ??? [2009-08-24 20:13:11 +0000 UTC]

Ooooo, sparkly pretty! I wish I could use this on my dA journal.

👍: 0 ⏩: 1

MixedMilkChOcOlate In reply to SparklyDest [2009-08-24 20:24:48 +0000 UTC]

oh yes it's could be awesome to use it everywhere
Thank you

👍: 0 ⏩: 0

CtrlAltSuprDelete In reply to ??? [2009-08-24 20:08:59 +0000 UTC]

Awesome

👍: 0 ⏩: 1

MixedMilkChOcOlate In reply to CtrlAltSuprDelete [2009-08-24 20:24:51 +0000 UTC]

Thank you

👍: 0 ⏩: 0

PatrickRuegheimer [2009-08-24 20:03:22 +0000 UTC]

awesome! :3

👍: 0 ⏩: 1

MixedMilkChOcOlate In reply to PatrickRuegheimer [2009-08-24 20:25:26 +0000 UTC]

Thank you

👍: 0 ⏩: 1

PatrickRuegheimer In reply to MixedMilkChOcOlate [2009-08-25 15:41:35 +0000 UTC]

You're welcome! :3

👍: 0 ⏩: 0


<= Prev |