Generate TV static in AS3


/ Published in: ActionScript 3
Save to your folder(s)

Generate snow, like on a TV set.


Copy this code and paste it in your HTML
  1. var tvStatic:MovieClip = new MovieClip();
  2. addChild(tvStatic);
  3.  
  4. var bmpData:BitmapData = new BitmapData(320,240);
  5. var bmp:Bitmap = new Bitmap(bmpData);
  6.  
  7. tvStatic.addChild(bmp);
  8.  
  9.  
  10. addEventListener(Event.ENTER_FRAME,generateStatic, false, 0, true);
  11.  
  12. private function generateStatic(e:Event){
  13. bmpData.noise(Math.floor(100000*Math.random()), 0, 255,0, true);
  14. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.