broken antenna
♥0 |
Line 54 |
Modified 2012-10-07 22:30:37 |
MIT License
archived:2017-03-20 02:18:59
ActionScript3 source code
/**
* Copyright milchreis ( http://wonderfl.net/user/milchreis )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/pLE5
*/
package
{
import flash.display.Sprite;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class FlashTest extends Sprite
{
private var noise:Noise;
public function FlashTest()
{
noise = new Noise(stage.stageWidth, stage.stageHeight);
var noiseDuration:Timer = new Timer(1000, 0);
noiseDuration.addEventListener(TimerEvent.TIMER, toggleNoise);
noiseDuration.start();
}
private function toggleNoise(e:TimerEvent):void
{
if (contains(noise))
{
removeChild(noise);
noise.stop();
}
else
{
addChild(noise);
noise.start();
}
}
}
}
import flash.display.BitmapData;
import flash.display.Bitmap;
import flash.display.BitmapDataChannel;
import flash.events.Event;
internal class Noise extends Bitmap
{
public function Noise (width:uint, height:uint)
{
bitmapData = new BitmapData(width, height);
animation(null);
}
public function start():void
{
addEventListener(Event.ENTER_FRAME, animation);
}
public function stop():void
{
removeEventListener(Event.ENTER_FRAME, animation);
}
private function animation(e:Event):void
{
bitmapData.noise(int(Math.random() * int.MAX_VALUE), 0, 0xFFFFFF, BitmapDataChannel.RED, true);
}
}