Shop Mobile More Submit  Join Login
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]
Add a Comment:
 
:icon79089:
79089 Featured By Owner Mar 10, 2015  Hobbyist Artist
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?/\
Reply
:icon79089:
79089 Featured By Owner Mar 9, 2015  Hobbyist Artist
BEST THING EVER! I CAN USE THIS 4EVEH (FOREVER!)
Reply
:iconsweetcreeper132pl:
SweetCreeper132PL Featured By Owner Sep 14, 2014
Don't works in Stencyl :B
Reply
:iconmatojeje:
Matojeje Featured By Owner Aug 16, 2014  Hobbyist Digital Artist
Lol, random emoticons
Reply
:iconleonbutt:
leonbutt Featured By Owner Jul 29, 2014   Digital Artist
how gonna use this?
Reply
:iconderpsilver:
DerpSilver Featured By Owner Jul 20, 2014  Hobbyist Digital Artist
Somehow, this kept me entertained for 4 hours straight O-o
Reply
:iconbgines:
Bgines Featured By Owner Jan 28, 2014  Hobbyist Digital Artist
var blur:BlurFilter
var objComplex:Object = {_obj:particule

Problems in code ROLF
Reply
:iconpinkiepierulez56:
pinkiepierulez56 Featured By Owner Aug 9, 2013
Tumblrcode? owo
Reply
:iconluvdibmembraine:
luvdibmembraine Featured By Owner Dec 19, 2012  Hobbyist Artist
SPARKLES!!!!!!!!!!xD:iconspeaklessplz:
Reply
:iconhickerbop:
Hickerbop Featured By Owner Nov 28, 2011  Student Digital Artist
mouse: yay im all sparkly :dummy:
Reply
:iconinoner:
inoner Featured By Owner Jul 11, 2011  Hobbyist General Artist
Um... you probably already noticed, but a few emotes show up in your script.
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Jul 16, 2011  Hobbyist Digital Artist
yes i allready see ^^;
Reply
:iconchibi-chocolate123:
chibi-chocolate123 Featured By Owner Oct 20, 2010
Er.. whats the code for............?
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Oct 22, 2010  Hobbyist Digital Artist
to be used, if you know actionscript :la:
Reply
:iconchibi-chocolate123:
chibi-chocolate123 Featured By Owner Nov 2, 2010
no er... i don't
Reply
:iconchibi-chocolate123:
chibi-chocolate123 Featured By Owner Oct 20, 2010
I love how the sparkles sort of melt
:iconsparklyplz:
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Oct 22, 2010  Hobbyist Digital Artist
:glomp:
Reply
:iconchibi-chocolate123:
chibi-chocolate123 Featured By Owner Nov 2, 2010
:tighthug:
Reply
:iconxxally7xx:
xxally7xx Featured By Owner Oct 14, 2010  Hobbyist Traditional Artist
pretty! lol :D
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Oct 17, 2010  Hobbyist Digital Artist
Thanks :la:
Reply
:iconirockthousuck:
iROCKthouSUCK Featured By Owner Sep 6, 2009  Hobbyist General Artist
Cute~~!!!^^
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Sep 6, 2009  Hobbyist Digital Artist
Really thank you :aww:
Reply
:iconbree333888:
Bree333888 Featured By Owner Aug 30, 2009
How shiny! :love:
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 30, 2009  Hobbyist Digital Artist
yes :thanks:
Reply
:iconglazeddoughnut:
GlazedDoughnut Featured By Owner Aug 28, 2009
reminds me of Hydrogenperoxid on Chicken Liver... :O

We had to do that in Biology today *vomits*
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 28, 2009  Hobbyist Digital Artist
haha sorry for that :lmao:
Reply
:iconglazeddoughnut:
GlazedDoughnut Featured By Owner Aug 29, 2009
AND I'm VEGETARIAN! grossed me out. it's ok, not you fault :dummy:
Reply
:iconrobloxlittle:
robloxlittle Featured By Owner Jan 27, 2013
same and nice icon
Reply
:icontompfield:
TomPField Featured By Owner Aug 27, 2009
nice!
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 27, 2009  Hobbyist Digital Artist
Thank you :w00t:
Reply
:iconfauxpeanut:
fauxpeanut Featured By Owner Aug 25, 2009
:la::+fav:
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
THank you :iconlaplz:
Reply
:iconemmuls:
Emmuls Featured By Owner Aug 25, 2009  Hobbyist Photographer
Awesome job Ni.......ooooooooooo shiny!!!!:iconiloveitplz:

sorry:phew:

:XD:
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
Too bad we can't use it everywhere :giggle:

Thanks :thanks:
Reply
:iconemmuls:
Emmuls Featured By Owner Aug 25, 2009  Hobbyist Photographer
I know, right :aww:

You're welcome :)
Reply
:iconstar784-nova:
star784-nova Featured By Owner Aug 25, 2009  Hobbyist Traditional Artist
Shinyyyyyy:la: Good work! :ohnoes:
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
I like shiny stuff :la:
Reply
:iconstar784-nova:
star784-nova Featured By Owner Aug 25, 2009  Hobbyist Traditional Artist
yay for shiny stuff! :la:
Reply
:iconpriteeboy:
priteeboy Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
Haha, I remember I was having a blast with This when I saw it. I had no idea you could do similar :XD:
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
lol this guy is french too :giggle:
I can because in the real life I'm not pixelartist but web programmer :giggle:

THank you :)
Reply
:iconpriteeboy:
priteeboy Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
I never would have guessed either of those :lol: 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 :D
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
lol not for the moment, I only got 600 euros per month :rofl:
But I only work 20 hours ^^
Reply
:iconpriteeboy:
priteeboy Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
That's better than me - I get nothing a month because I have no job lol :saddrunk:
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
oh but I'm sure you will find one you are awesome :w00t:
Reply
:icondark-matter-13:
Dark-Matter-13 Featured By Owner Aug 24, 2009
It looks like my mouse is drowning. :o
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 25, 2009  Hobbyist Digital Artist
haha yes :giggle:
Reply
:iconhsngonewild:
HsnGoneWild Featured By Owner Aug 24, 2009  Hobbyist Digital Artist
nice job, but why is it so slow ? xD
Reply
:iconmixedmilkchocolate:
MixedMilkChOcOlate Featured By Owner Aug 24, 2009  Hobbyist Digital Artist
Really slow :?
I don't know the frame speed is 30 so every 1 second 30 pixel are created :faint:
Thanks ^^
Reply
:iconhsngonewild:
HsnGoneWild Featured By Owner Aug 24, 2009  Hobbyist Digital Artist
i don't know why it is slow >_> maybe it's just me
Reply
:iconleogomes91:
leogomes91 Featured By Owner Aug 24, 2009  Hobbyist Digital Artist
yay!! milky, the code master!! :glomp:
sorry i didn't edit your ID yet.. i didn't have time these days.. but i promise i will as soon as possible =D
Reply
Add a Comment:
 
×
Download SWF download, 1.1 KB




Details

Submitted on
August 24, 2009
Image Size
1.1 KB
Resolution
550×400
Link
Thumb
Embed

Stats

Views
5,168 (2 today)
Favourites
162 (who?)
Comments
106
Downloads
137
×