Deviant Login Shop  Join deviantART for FREE Take the Tour
×



Details

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

Stats

Views
4,536
Favourites
157 (who?)
Comments
103
Downloads
134
×
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:
 
:iconmatojeje:
Matojeje Featured By Owner Aug 16, 2014  Student Digital Artist
Lol, random emoticons
Reply
:iconkawibutt:
kawibutt Featured By Owner Jul 29, 2014  Student 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
Add a Comment: