MixedMilkChOcOlate on DeviantArthttps://www.deviantart.com/mixedmilkchocolate/art/Make-my-mouse-shine-script-134603221MixedMilkChOcOlate

Deviation Actions

MixedMilkChOcOlate's avatar

Make my mouse shine script

Published:
7.2K Views

Description

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]
Image size
550x400px 1.07 KB
© 2009 - 2024 MixedMilkChOcOlate
Comments108
Join the community to add your comment. Already a deviant? Log In
CreepenMiner's avatar
DONT READ THIS. YOU WILL BE KISSED ON THE BEST DAY OF
YOUR LIFE. NOW THAT YOU'VE STARTED READING, DONT STOP. THIS IS SO 
FREAKY. 1 say your name 10 times 2. say your mum's name 5 times and your
crushes name 3 times 4. paste this onto 4 other games. If you do this, 
your crush will kiss you on the nearest Friday possible. But if you read
this and do not paste this, you will get bad luck. SEND THIS ON 5 
DIFFERENT GAMES IN 143 MINUTES. WHEN YOUR DONE, PRESS F6 AND YOUR 
CRUSHES NAME WILL APPEAR IN BIG LETTERS. THIS IS SO FREAKY IT ACTUALLY 
WORKS