Question

So I've got a field of yellow balls on the stage in rows all the way down the screen. About 200 of them. They're all movieClips linked from one ball MovieClip in the library.

I'm storing them in an Array called ballField.

I've also got a video feed on the stage (right now from webcam, but later will be whatever video I choose).

I want the video to be broken down into binary colour (black and white contrast).

Then I want to hit test all of the balls MovieClips against the color white from the video on enter frame.

Whenever a ball is 'hit' I want it to become visible. Whenever it's not hit, it will be invisible.

Essentially I want the end product to be a video created out of a field of balls (each ball would be like a binary pixel) appearing and disappearing against the white motion of the background video, (once it's working I'll hide the source) to give the illusion of a video created out of yellow balls.

This is a little over my head. I researched several options using the Bitmap data class for collision detection, but I'm not sure how to hitTest colours versus points. And I'm not sure how to hitTest bitmap data from a video to a MovieClip.

Any help is appreciated..

Was it helpful?

Solution

Hrm, one way I see to do this is for every ball, get the position of it and compare it to the pixel on the video it is supposed to match (may need to do some of your own mapping logic here). Then just look up that pixel colour to determine if the ball is visible or not. No hitTesting needed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top