Search This Blog

26 May 2011

Evaluations on the Project

Here is a link to Elliot Walbys' Evaluation on the project.

http://hotfile.com/dl/118990731/a7ace5b/Evaluation.docx.html

Security system 2

OK, so this is the AS3 code we ended up using:


import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.events.KeyboardEvent;




var bandwidth:int = 0; // Maximum amount of bandwidth that the current outgoing video feed can use, in bytes per second.
var quality:int = 100; // This value is 0-100 with 1 being the lowest quality. 


var cam:Camera = Camera.getCamera();
cam.setQuality(bandwidth, quality);
cam.setMode(320,240,30,false); // setMode(videoWidth, videoHeight, video fps, favor area)
var video:Video = new Video();
video.attachCamera(cam);
video.x = -500;
video.y = -500;
addChild(video);


//This tells flash to detect a webcam and 
//attach its video feed to the stage
//(this particular feed is hidden outside the stage)


var bitmapData:BitmapData = new BitmapData(video.width,video.height);


var bitmap:Bitmap = new Bitmap(bitmapData);










stage.addEventListener(KeyboardEvent.KEY_DOWN, alarm);
function alarm(event:KeyboardEvent):void{
if (event.keyCode==74){

//This tells flash to 'listen' for a keyboard 
//command. If key 74 (j) is pressed, do the following:


bitmap.x = 119;
bitmap.y = 72;
bitmap.width = 320;
bitmap.height = 240;
addChild(bitmap);
bitmapData.draw(video);

// This tells flash to place a still image from 
//the video feed at the moment of the keyboard 
//command at the specified co-ordinates


var theDate:Date = new Date( );
var day = theDate.toLocaleDateString() // This tells flash to define the var 'date' by the computers RTC (real time clock)
var time = theDate.toLocaleTimeString()// This tells flash to define the var 'time' by the computers RTC


time_txt.text = time;
// This tells flash to input the time 
//as defined by the previous var statement 
//into the 'time_txt' object


day_txt.text = day;
// This tells flash to input the date 
//as defined by the previous var statement 
//into the 'day_txt' object
}
}




I've commented it out to make it easier to understand

Elliot made a background to go with this project.




So basically, our idea was to have the system to start capturing a video when a sensor was tripped and save it to 2 places after it has stopped recording an hour after the last sensor was tripped. However, without PHP and a online flash server, we cannot save the files. Also, Flash really doesn't like recording video. It requires each frame to be drawn into Bitmaps individually and then compiled and rendered into an animation.

Now we don't know PHP or have an online flash server or have to time to do either.

We settled with capturing an image from a video feed. When the SWF is open, it starts using the webcam just streaming a live feed to the stage, then when the sensor is activated, flash creates an image from the video feed and places it on the stage.

We cannot save these images so the only thing you can see is the last thing it saw. This is less than perfect but all we can do at this point.

19 May 2011

Security System

So, our Idea is a security system. This is the basic map below.








































We can use the pressure pad code and the laser code to turn on the camera (webcam). I'm just lost on the logs :S

So I got the webcam working with

output_vid.attachVideo(Camera.get());

Where output_vid is the name of my movie clip. So now I got an image showing webcam.

I'm getting the feeling you can't save a movie.Apparently it can't interact with your PC or something. I'd need to use some PHP which I don't have time for so we're now pretending it records.


this.onEnterFrame = function()
{
if (Key.isDown(80))
{
gotoAndStop(2)


}
}


But for some reason, it's now not working. It worked for a minute, I tried to change some things to time the last frame but then nothing. I removed the changes, put it right back and nothing.


With all of these hiccups, Lee is giving us some new code. We're removing the video for a snapshot with time and date. I'd like to be able to store them after they were taken