Created
October 20, 2011 10:29
-
-
Save NicolaiSattler/1300844 to your computer and use it in GitHub Desktop.
line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package | |
| { | |
| import flash.display.GradientType; | |
| import flash.display.Sprite; | |
| import flash.events.Event; | |
| public class Line extends Sprite | |
| { | |
| public var _age:uint; | |
| public var _maxAge:uint; | |
| public var _speed:Array=new Array(); | |
| public var _effectList2:Array = new Array; | |
| public function Line() | |
| { | |
| addEventListener(Event.ADDED_TO_STAGE,init); | |
| } | |
| public function init(e:Event):void | |
| { | |
| removeEventListener(Event.ADDED_TO_STAGE,init); | |
| //_speed['x'] = Math.random()*1-0.5; // -5 omdat hij anders tussen 0 en 10 werkt (dus nu naar links en naar rechts) | |
| //_speed['y'] = Math.random()*1-0.5; | |
| _maxAge=168; | |
| drawMe();// deze functie uitvoeren | |
| addEventListener(Event.ENTER_FRAME, animateMe); // als ik op een frame begin voer ik deze functie uit | |
| } | |
| public function drawMe():void | |
| { | |
| this.graphics.beginGradientFill(GradientType.RADIAL,[Math.random()*0xffffff,Math.random()*0xffffff],[0,1],[0,25]); //[0,1] alpha 0 tot 1 | |
| //this.graphics.beginFill(Math.random()*0XFFFFFF);//this --> dit object | |
| //this.graphics.drawCircle(0, 0, 10); --->dots | |
| this.graphics.drawEllipse(-4,-8,12,16); | |
| this.graphics.endFill(); | |
| } | |
| public function animateMe(e:Event):void | |
| { | |
| _age++; | |
| this.rotation += 2; | |
| for (var i:int = 0; i<_effectList2.length;i++) | |
| { | |
| _effectList2[i].effect(this); | |
| } | |
| if (_age>=_maxAge) | |
| { | |
| deleteMe(); | |
| } | |
| } | |
| public function deleteMe():void | |
| { | |
| this.removeEventListener(Event.ENTER_FRAME, animateMe); | |
| this.parent.removeChild(this); //hij gaat naar de parent en verwijdert de child waar hij nu in zit.. zeg maar ^-^ | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment