5/24/2010 4:58:53 PM
Title:
Camera => Status and Activity problem
Hello
I've got a problem. A found a page where is an example how to make a camera status/activity event listening, but it's not working for me :S
http://blog.flexexamples.com/2008/01/22/displaying-a-webcams-video-in-a-flex-videodisplay-control/
I try everything what i find, but i don't have more idea what's the problem.
(I try with Flex 3, Flex 4, and try to check in IE and Firefox but nothing)
Any suggestion, workable example?
Best Regards,
Gergo Szabo
5/24/2010 9:07:01 PM
to attach a camera activity listener event use the following code :
// camera is your Camera object
camera.addEventListener(ActivityEvent.ACTIVITY, camera_activity);
private function camera_activity(evt:ActivityEvent):void {
trace(evt.type);
}
Inder
Points: 2980
Posts:0
5/24/2010 9:42:58 PM
check this code to attach status and activity event handlers to camera in flex with actionscript 3.0:
//Call attachCamera function to attach the default camera
private var myWebCam:Camera
private function attachCamera():void {
myWebCam = Camera.getCamera();
//videoDisplay is your "VideoDisplay" component in flex
videoDisplay.attachCamera(myWebCam);
myWebCam.addEventListener(ActivityEvent.ACTIVITY, myCamera_activity);
myWebCam.addEventListener(StatusEvent.STATUS, myCamera_status);
}
private function myCamera_activity(actEvent:ActivityEvent):void {
trace(actEvent.type);
}
private function myCamera_status(statEvent:StatusEvent):void {
trace(statEvent.code);
}
2/15/2011 1:38:45 AM
how to attach camera in flex 4
Shawn
Points: 680
Posts:0
2/16/2011 1:44:00 AM
@nithya its same as we do in flex 3, see answer by inder
8/16/2011 7:06:27 AM
private var myWebCam:Camera
private function attachCamera():void {
myWebCam = Camera.getCamera();
//videoDisplay is your "VideoDisplay" component in flex
videoDisplay.attachCamera(myWebCam);
myWebCam.addEventListener(ActivityEvent.ACTIVITY, myCamera_activity);
myWebCam.addEventListener(StatusEvent.STATUS, myCamera_status);
}
private function myCamera_activity(actEvent:ActivityEvent):void {
trace(actEvent.type);
}
private function myCamera_status(statEvent:StatusEvent):void {
trace(statEvent.code);
}
What if no event is fired ?