header
ask question
Click here to ask Question Now Its free No registration required. Flash, Flex, Flash Media Server, ActionScript,Adobe Air. Most questions receive a response in an hour.
Gergo Szabo
Points:0
Posts:0
Answered

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



1
Rex
Points: 1280
Posts:0
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);
}

2
Inder
Points: 2980
Posts:0
Accepted Answer
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);
}

3
Gergo Szabo
Points: 0
Posts:0
5/25/2010 3:31:01 AM



Thank You Inder!

4
nithya
Points: 0
Posts:0
2/15/2011 1:38:45 AM



how to attach camera in flex 4

5
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

6
Franko
Points: 0
Posts:0
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 ?


Post your Reply
Name  

Email

Type your Reply or Answer

Are you human? What is 3+4 



Members Login

Email  
Password
Forgot Password





This website focus on: Flash | Flex | FMS | RED5 | WOWZA | Flash Media Server | Adobe AIR | ActionScript,Flash Solutions | Flash Question | Flash Answers | Flash Developers | Flash Problem, Flash Help, Flash bugs, Flash workaround | Flash Blog | Flex Question Answers | Flash Forum | Flex Development | Actionscript development | Flash development | Adobe AIR development
Copyright © 2008 AskMeFlash.com. All rights reserved. Privacy Policy | Terms & Conditions