# TV Static \[as3\]

**URL:** https://forum.kirupa.com/t/tv-static-as3/275234
**Category:** open source
**Created:** [November 11, 2008, 4:02pm UTC](https://forum.kirupa.com/t/tv-static-as3/275234 "2008-11-11T16:02:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![rai\_kane3](https://avatars.discourse-cdn.com/v4/letter/r/e47774/32.png) [@rai\_kane3](https://forum.kirupa.com/u/rai_kane3)
#### Post date: [November 11, 2008, 4:02pm UTC](https://forum.kirupa.com/t/tv-static-as3/275234/1 "2008-11-11T16:02:46Z")

</div>

Here is senoculars TV Static converted to AS3

[original as2 link](http://www.senocular.com/flash/source.php?id=0.200)

```auto
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.display.BitmapDataChannel;

// create a new movie clip for the static
var static_mc:MovieClip = new MovieClip();

this.addChild(static_mc);

// position the static movie clip with the mask
static_mc.x = mask_mc.x;
static_mc.y = mask_mc.y;

// create a bitmap data instance the size of the mask
// that will be used to draw static in
var _bitmapData = new BitmapData(mask_mc.width, mask_mc.height);
var _bitmap = new Bitmap(_bitmapData)

// attach the bitmap to the static movie clip
static_mc.addChild(_bitmap);

// apply the mask
static_mc.mask = mask_mc;

static_mc.addEventListener(Event.ENTER_FRAME, _static);

// every frame draw static
function _static(e:Event):void
{
    var seed:int = int(Math.random() * int.MAX_VALUE);
    _bitmapData.noise(seed, 0, 0xFFFFFF, BitmapDataChannel.RED, true);
}

```
