Hi guys,
Im trying to use this example code from:
http://www.michelvandersteege.nl/blog/archives/266
function splitRGB(img:DisplayObjectContainer):Object
{
var bmd:BitmapData = new BitmapData(img.width, img.height);
bmd.draw(img);
var r:BitmapData = new BitmapData(bmd.width, bmd.height, true, 0xFF000000);
var g:BitmapData = new BitmapData(bmd.width, bmd.height, true, 0xFF000000);
var b:BitmapData = new BitmapData(bmd.width, bmd.height, true, 0xFF000000);
var rect:Rectangle = new Rectangle(0, 0, bmd.width, bmd.height);
r.copyChannel(bmd, rect, new Point(0,0), BitmapDataChannel.RED, BitmapDataChannel.RED);
g.copyChannel(bmd, rect, new Point(0,0), BitmapDataChannel.GREEN, BitmapDataChannel.GREEN);
b.copyChannel(bmd, rect, new Point(0,0), BitmapDataChannel.BLUE, BitmapDataChannel.BLUE);
var h:Sprite = new Sprite();
img.parent.addChild(h);
h.x = img.x;
h.y = img.y;
img.visible = false;
return {r:h.addChild(new Bitmap(r)), g:h.addChild(new Bitmap(g)), b:h.addChild(new Bitmap(b))};
}
var rgb:Object = splitRGB(img);
rgb.r.blendMode = BlendMode.SCREEN;
rgb.g.blendMode = BlendMode.SCREEN;
rgb.b.blendMode = BlendMode.SCREEN;
function update(e:Event):void
{
var val:Number = Math.random() * 10;
rgb.r.x = rgb.r.y = val;
rgb.b.x = rgb.b.y = -val;
}
stage.addEventListener(Event.ENTER_FRAME, update);
All im doing is copy/paste it into flash cs3 in a as3 project onto the first frame and placing a MC on stage wich is an image.
Im getting this error: 1120: Access of undefined property img.
Can someone please help me figure it out?
Thank you.