Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package
- {
- import Visualizer2.*;
- import flash.display.*;
- import flash.events.*;
- import flash.filters.*;
- import flash.media.*;
- import flash.utils.*;
- import flash.net.*;
- import flash.geom.*;
- class Visualizer2 extends MovieClip
- {
- private var pic:Bitmap;
- private var ___height:uint;
- private var ___width:uint;
- private var sc:SoundChannel;
- private var s:Sound;
- private var res:Number = 2;
- private var gfx:BitmapData;
- private var zz:Number = 0;
- private var ba:ByteArray;
- function Visualizer2(param3:Number, param4:Number)
- {
- s = new Sound();
- sc = new SoundChannel();
- ba = new ByteArray();
- res = 2;
- zz = 0;
- ___width = param3;
- ___height = param4;
- gfx = new BitmapData(param3,param4,false,0);
- pic = new Bitmap(gfx);
- addChildAt(pic, 0);
- EventManager.addEventListener(this,Event.ENTER_FRAME, processSpectrum);
- return;
- }// end function
- private function processSpectrum(event:Event)
- {
- var _loc_2:Number = NaN;
- var _loc_3:int = 0;
- var _loc_4:BlurFilter = null;
- var _loc_5:* = undefined;
- var _loc_6:int = 0;
- SoundMixer.computeSpectrum(ba, true, 0);
- _loc_2 = ba.readFloat();
- l = Math.pow(_loc_2,3) * ___width / 10;
- _loc_3 = 0;
- while (_loc_3 < 1440)
- {
- gfx.setPixel(l, _loc_3, 16777215 * Math.pow(_loc_3, 2));
- _loc_6 = 0;
- while (_loc_6 < res)
- {
- gfx.setPixel(Math.sin(_loc_3 / 360 * Math.PI) * l + _loc_6 * (___width / res) - 50, _loc_3 / _loc_6, 16777215 * Math.pow(_loc_3, 2));
- _loc_6 = _loc_6 + 1;
- }
- _loc_3 = _loc_3 + 1;
- }
- _loc_4 = new BlurFilter(2,2);
- _loc_5 = new DisplacementMapFilter(gfx,new Point(0,0),2,1,zz * l / 6,zz + 3);
- gfx.applyFilter(gfx, new Rectangle(0, 0, ___width, ___height), new Point(0, 0), _loc_5);
- gfx.applyFilter(gfx, new Rectangle(0, 0, ___width, ___height), new Point(0, 0), _loc_4);
- zz = 4;
- return;
- }// end function
- public function removeSelf()
- {
- if (!parent)
- {
- return;
- }
- EventManager.removeAllListeners();
- pic.parent.removeChild(pic);
- parent.removeChild(this);
- }
- }
- }
Add Comment
Please, Sign In to add comment