Andre Michelle's Tile based Scrolling ported to AS 3

Update:- I have found something that has to be added to the existing code. The SWF embedded here runs only @ around 60 FPS on a Safari or Firefox on a Mac. I will work on a more consistent render loop code adding some timer calculation elements soon.

I have ported the Tile based scrolling in Flash code by Andre Michelle to use Actionscript 3.0
Main challenge I faced was the tearing issue which was removed after I used Timer Event and updateAfterEvent() method. Thanks to 8bitRocket site for the tip.

I am getting a blazing 160 FPS in browser.. OMG Flash rocks ! If anyone wants me to provide comments and documentation for the code. I will happily do it on request.

Click here to get the full source code.

P.S. If its slow, its because you might be having the static noise swf playing below (scroll page down). View on the post page by click the title to ensure it plays smoothly.

Creating Static TV Noise in Flash using AS3

Creating Fast and Smooth Static TV Noise in Flash using AS3 was a simpler task than I expected it. First attempt was using for loops to set every pixel and was not very fast. A Simple browse through the API docs for BitmapData class gave me the 'noise' method

bgdata.noise(Math.random() * 1000, 0, 255, 7, true);
did the trick :)

Complete code below

package {
import flash.display.Sprite;
import flash.display.Graphics;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.geom.Point;
public class StaticNoise extends Sprite {
const ww = 480;
const hh = 272;
var bgdata:BitmapData = new BitmapData(ww, hh, false, 0xffffff);
var bg:Bitmap = new Bitmap(bgdata);
var zeroPt:Point = new Point(0,0);
public function StaticNoise() {
addEventListener(Event.ENTER_FRAME, drawBaby);
function drawBaby(e:Event) {
bgdata.noise(Math.random() * 1000, 0, 255, 7, true);

You can modify,use this code where ever you want, without giving credits. But please just let me know in the comments if it helped you.