PDA

View Full Version : camera fun


smartie_on_computer
04-25-2006, 06:51 AM
Camera Fun

smartie_on_computer
04-25-2006, 08:51 PM
here's my script:
initialize();
output.attachVideo(cam);
function initialize() {
list = new Array();
m = new Matrix();
m.scale((output._xscale/100), (output._yscale/100));
now = new BitmapData(output._width, output._height);
out = new BitmapData(output._width, output._height);
setInterval(this, "snap", 100);
}
function snap() {
now.draw(output, m);
done = now.clone();
done.draw(before, m, null, "difference");
done.threshold(done, done.rectangle, done.rectangle.topLeft, ">", 0xFF111111, 0xFF00FF00, 0x00FFFFFF, false);
list.push(done.clone());
if (list.length>max) {
list.shift().dispose();
}
var l = list.length;
var each = 255/l;
var g;
out.fillRect(out.rectangle, 0xFF000000);
before = now.clone();
for (var i = 0; i<l; ++i) {
g = each*i;
out.threshold(list[i], out.rectangle, out.rectangle.topLeft, "==", 0xFF00FF00, (255 << 24 | 0 << 16 | g << 8 | 0), 0x00FFFFFF, false);
}
}
var balls:Array = new Array();
for (z=0; z<5; z++) {
balls[z] = _root["ball"+z];
}
var CX = this.output._x;
var CY = this.output._y;
_root.onEnterFrame = function() {
for (w=0; w<5; w++) {
map.draw(out);
var clr = _root.map.getPixel(balls[w]._x-CX, balls[w]._y-CY);
if (clr<80000 and clr>50000) {
_root.balls[w].kill();
this.num_txt.text = clr;
}
}
this.num_txt.text = clr;
};
this.cant_btn.onRelease = function(){
System.showSettings(3);
}
sorry 56 lines fo code :(

smartie_on_computer
05-02-2006, 07:55 PM
sorry, forgot to say, needs flash 8 or higher

P.S. common. im waiting on some one to come up with ideas :p :D :p

afaassen
10-09-2006, 02:25 PM
the code does nothing when i cut and paste it in the first frame of flash8.
Am i missing some files or objects i need to make before it works?

I am looking for a audio triggering through the camera movement

Thanks in advance

icktoofay
10-21-2006, 02:19 AM
i know this creation is awesome... but i don't have a webcam :(
...and could you post the fla? theres the code and theres the source

mrVin
10-25-2006, 04:13 AM
ehehe nice one!

smartie_on_computer
10-29-2006, 08:21 PM
yea soruce is comming soon (once i find the fla)

sorry for the long wait :S

crespito
11-07-2006, 06:28 PM
GREAT WORK!!!

do you have the fla file???

Ill post mi work as soon is finished, since i am working on something similar using collision detection