Today we will be fooling around with webcam.
First of all we can load a webcam on the screen (or stage). This is done in a function.
The webcam can trigger loading of images and playing of sounds etc, (so can the microphone.)
The structure of the script is not too difficult: you add an object (there is the box again), this object is a webcam for tonight. Then you add an eventlistener. And the eventlisteners triggers a function when the event happens.
So we have:
- webcam
- eventlistener
- function on event
This is the same as:
- keyboard - eventlistener - function on event
- mouse - eventlistener - function on event
In the function you can put what you want, it can be loading an image, playing a sound...starting a movie......
The way to create the webcam is done in a function. This is like the functions of loading an image or streaming a sound. In principle you can copy paste these functions and use them like black boxes.
The working examples can be found in this folder, with examples:
http://www.contrechoc.com/flash/flashExamples.zip
if FLASH complains about the version of the .fla file, use the content of the txt file in the folder, copy paste it into a new flash movie, save in the folder with the sounds and images, and enjoy...
if FLASH complains about the version of the .fla file, use the content of the txt file in the folder, copy paste it into a new flash movie, save in the folder with the sounds and images, and enjoy...
A funny examples from former classes:
Made by Danuta, in her movie your mustache is changed when moving around!
Security setting
Flash is played from website on your computer. So flash movies are not supposed to be able to get data from your computer. Nor are flash movies supposed to activate your webcam without your consent. So every time you use the webcam you have to give permission to do this.
So there is a possibility that when you start the movie with the webcam it wont play immediately.
If nothing is playing or the mic does not respond, first verify if the computer has a mic or webcam, and then try clicking right in the flash window and look at the settings.
More can be done with the webcam than you think: Augmented Reality Flash, or Multitouch Flash is done also with this simple webcam.
Remark: close scrutiny showed that the activity handler is always triggering two times before tting into the normal waiting for a trigger mode. So to do it well,
used:
* webcam activity: eventlistener
* microphone activity: eventlistener
Advanced: you can have a picture, and want to replace colors in it? Using a blue screen for example.
http://keywon.com/wiki/index.php?title=Flash_Reference_-_BitmapData
You can do this on the image of the webcam too, replacing the color of a Hummer with the color on a specific spot of the webcam.
Using lightsource as a mouse works like this, webcam, bitmapimage, threshold...
http://board.flashkit.com/board/showthread.php?t=753887
Advanced: you can have a picture, and want to replace colors in it? Using a blue screen for example.
http://keywon.com/wiki/index.php?title=Flash_Reference_-_BitmapData
You can do this on the image of the webcam too, replacing the color of a Hummer with the color on a specific spot of the webcam.
Using lightsource as a mouse works like this, webcam, bitmapimage, threshold...
http://board.flashkit.com/board/showthread.php?t=753887

