HOME | DD

MixedMilkChOcOlate β€” Make my mouse shine script

Published: 2009-08-24 20:01:17 +0000 UTC; Views: 7218; Favourites: 156; Downloads: 153
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

79089 [2015-03-10 21:14:49 +0000 UTC]

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?/\

πŸ‘: 0 ⏩: 0

79089 [2015-03-09 22:06:19 +0000 UTC]

BEST THING EVER! I CAN USE THIS 4EVEH (FOREVER!)

πŸ‘: 0 ⏩: 0

SweetCreeper132PL [2014-09-14 07:10:02 +0000 UTC]

Don't works in Stencyl

πŸ‘: 0 ⏩: 0

That-Tiny-Rii [2014-08-16 19:03:19 +0000 UTC]

Lol, random emoticons

πŸ‘: 0 ⏩: 0

milkboys [2014-07-29 16:51:58 +0000 UTC]

how gonna use this?

πŸ‘: 0 ⏩: 0

DerpSilver [2014-07-21 06:46:41 +0000 UTC]

Somehow, this kept me entertained for 4 hours straight O-o

πŸ‘: 0 ⏩: 0

Bgines [2014-01-29 02:54:59 +0000 UTC]

var blurlurFilter

var objComplexbject = {_objarticule


ProblemsΒ in code ROLF

πŸ‘: 0 ⏩: 0

pinkiepierulez56 [2013-08-09 21:28:07 +0000 UTC]

Tumblrcode? owo

πŸ‘: 0 ⏩: 0

luvdibmembraine [2012-12-20 00:36:09 +0000 UTC]

SPARKLES!!!!!!!!!!xD

πŸ‘: 0 ⏩: 0

Hickerbop [2011-11-29 00:31:21 +0000 UTC]

mouse: yay im all sparkly

πŸ‘: 0 ⏩: 0

inoner [2011-07-12 04:10:17 +0000 UTC]

Um... you probably already noticed, but a few emotes show up in your script.

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to inoner [2011-07-16 19:19:08 +0000 UTC]

yes i allready see

πŸ‘: 0 ⏩: 0

chibi-chocolate123 [2010-10-20 14:22:14 +0000 UTC]

Er.. whats the code for............?

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to chibi-chocolate123 [2010-10-22 17:33:22 +0000 UTC]

to be used, if you know actionscript

πŸ‘: 0 ⏩: 1

chibi-chocolate123 In reply to MixedMilkChOcOlate [2010-11-02 13:21:10 +0000 UTC]

no er... i don't

πŸ‘: 0 ⏩: 0

chibi-chocolate123 [2010-10-20 12:01:21 +0000 UTC]

I love how the sparkles sort of melt

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to chibi-chocolate123 [2010-10-22 17:38:46 +0000 UTC]

πŸ‘: 0 ⏩: 1

chibi-chocolate123 In reply to MixedMilkChOcOlate [2010-11-02 13:15:20 +0000 UTC]

πŸ‘: 0 ⏩: 0

xxally7xx [2010-10-14 15:43:21 +0000 UTC]

pretty! lol

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to xxally7xx [2010-10-17 09:00:47 +0000 UTC]

Thanks

πŸ‘: 0 ⏩: 0

iROCKthouSUCK [2009-09-06 07:14:41 +0000 UTC]

Cute~~!!!^^

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to iROCKthouSUCK [2009-09-06 08:11:12 +0000 UTC]

Really thank you

πŸ‘: 0 ⏩: 0

Bree333888 [2009-08-31 00:56:50 +0000 UTC]

How shiny!

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to Bree333888 [2009-08-31 06:12:01 +0000 UTC]

yes

πŸ‘: 0 ⏩: 0

GlazedDoughnut [2009-08-29 02:31:28 +0000 UTC]

reminds me of Hydrogenperoxid on Chicken Liver...

We had to do that in Biology today *vomits*

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to GlazedDoughnut [2009-08-29 06:45:09 +0000 UTC]

haha sorry for that

πŸ‘: 0 ⏩: 1

GlazedDoughnut In reply to MixedMilkChOcOlate [2009-08-30 02:31:44 +0000 UTC]

AND I'm VEGETARIAN! grossed me out. it's ok, not you fault

πŸ‘: 0 ⏩: 1

robloxlittle In reply to GlazedDoughnut [2013-01-27 21:54:22 +0000 UTC]

same and nice icon

πŸ‘: 0 ⏩: 0

TomPField [2009-08-27 11:30:39 +0000 UTC]

nice!

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to TomPField [2009-08-27 11:39:59 +0000 UTC]

Thank you

πŸ‘: 0 ⏩: 0

fauxpeanut [2009-08-26 05:50:52 +0000 UTC]

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to fauxpeanut [2009-08-26 06:30:10 +0000 UTC]

THank you

πŸ‘: 0 ⏩: 0

Emmuls [2009-08-25 14:32:02 +0000 UTC]

Awesome job Ni.......ooooooooooo shiny!!!!

sorry

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to Emmuls [2009-08-25 14:46:59 +0000 UTC]

Too bad we can't use it everywhere

Thanks

πŸ‘: 0 ⏩: 1

Emmuls In reply to MixedMilkChOcOlate [2009-08-25 17:35:42 +0000 UTC]

I know, right

You're welcome

πŸ‘: 0 ⏩: 0

star784-nova [2009-08-25 09:31:22 +0000 UTC]

Shinyyyyyy Good work!

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to star784-nova [2009-08-25 13:37:51 +0000 UTC]

I like shiny stuff

πŸ‘: 0 ⏩: 1

star784-nova In reply to MixedMilkChOcOlate [2009-08-25 14:45:28 +0000 UTC]

yay for shiny stuff!

πŸ‘: 0 ⏩: 0

Chromattix [2009-08-25 07:40:24 +0000 UTC]

Haha, I remember I was having a blast with This when I saw it. I had no idea you could do similar

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to Chromattix [2009-08-25 13:38:35 +0000 UTC]

lol this guy is french too
I can because in the real life I'm not pixelartist but web programmer

THank you

πŸ‘: 0 ⏩: 1

Chromattix In reply to MixedMilkChOcOlate [2009-08-25 13:47:44 +0000 UTC]

I never would have guessed either of those Web designer is a good skill these days. Unfortunately, pixel-art isn't a very profitable art form but I bet your web skills make up for it

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to Chromattix [2009-08-25 13:51:27 +0000 UTC]

lol not for the moment, I only got 600 euros per month
But I only work 20 hours ^^

πŸ‘: 0 ⏩: 1

Chromattix In reply to MixedMilkChOcOlate [2009-08-25 13:52:37 +0000 UTC]

That's better than me - I get nothing a month because I have no job lol

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to Chromattix [2009-08-25 13:58:11 +0000 UTC]

oh but I'm sure you will find one you are awesome

πŸ‘: 0 ⏩: 0

Dark-Matter-13 [2009-08-25 06:33:55 +0000 UTC]

It looks like my mouse is drowning.

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to Dark-Matter-13 [2009-08-25 13:39:13 +0000 UTC]

haha yes

πŸ‘: 0 ⏩: 0

HsssN [2009-08-25 02:51:04 +0000 UTC]

nice job, but why is it so slow ? xD

πŸ‘: 0 ⏩: 1

MixedMilkChOcOlate In reply to HsssN [2009-08-25 06:09:41 +0000 UTC]

Really slow
I don't know the frame speed is 30 so every 1 second 30 pixel are created
Thanks ^^

πŸ‘: 0 ⏩: 1

HsssN In reply to MixedMilkChOcOlate [2009-08-25 06:57:04 +0000 UTC]

i don't know why it is slow >_> maybe it's just me

πŸ‘: 0 ⏩: 0

leogomes91 [2009-08-25 01:43:13 +0000 UTC]

yay!! milky, the code master!!
sorry i didn't edit your ID yet.. i didn't have time these days.. but i promise i will as soon as possible

πŸ‘: 0 ⏩: 1


| Next =>