HOME | DD

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 _boolMouse
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
_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
// 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 = {_obj
articule, _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
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 = {_obj
articule
ProblemsΒ in code ROLF
π: 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 iROCKthouSUCK [2009-09-06 08:11:12 +0000 UTC]
Really thank you
π: 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
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
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
MixedMilkChOcOlate In reply to Dark-Matter-13 [2009-08-25 13:39:13 +0000 UTC]
haha yes
π: 0 β©: 0
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 =>