0
votes

I'm developing a Flash application that works with a web camera.
I want to analyze every frame of the video recording... which is the proper event listener?

This is my actual code:

private var video: Video;
private var webcam: Camera;

public function AugmentedReality() {
    webcam = Camera.getCamera();
    if (webcam != null) {
        webcam.setMode(WEB_CAMERA_WIDTH, WEB_CAMERA_HEIGHT, VIDEO_FRAME_RATE);
        video = new Video(VIDEO_WIDTH, VIDEO_HEIGHT);
        video.attachCamera(webcam);
        this.addChild(video);
        this.addEventListener(Event.ENTER_FRAME, handler);
    }
}

private function handler(aEvent : Event):void {
    // I don't want to use this handler,
    // it is called several times on the same frame if FPS is low
}
1

1 Answers

1
votes

I'm not sure what you mean by "analyze every frame of the video recording" but there is the ActivityEvent, for detecting that the camera image has changed since the previous frame:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html#setMotionLevel

There is also quite a lot of work done in motion detection and motion tracking using Flash/ActionScript and the Camera object that you can find code examples for.