Kids Moving Things on Screen with a Web Cam and Flash

Kids Gesturing for Camera Interaction

There was a request to use Ostrich for helping sooth kids with trauma – sound like a good cause.  We put together a simple package to help the designer get under way.  It shows two MovieClips on stage that trigger camera motion.  This can be as many clips as you want.  You could then animate the clip, play a sound, etc.

Download Zip File Example

(still need to download Ostrich at right and have the files in the com directory installed in a folder in your Flash class path)

It becomes more tricky to have the clips move location – you would need to adjust the code to dispose of the MotionCursor object for the clip that has changed position and then make a new MotionCursor for it.  Certainly possible but tricky.


28 Responses

  1. Thank you!

    There are few people like you in this world today, you are one in a million.

    You will be kept up to date, thank you so very much!!

  2. Hi Dan I’ve been trying to use this Gesture package but it seems that because of the change in code relating to the Mac Camera it no longer works. I’ve tried using the Camera.Ready event like in the sample files but I can’t get it to work. Any idea how to fix this? Thanks.

  3. Hi Dan
    I am also having issues with it working (no complier errors), Im on a MacBook Pro, camera is activated and working. Just no cursor activation, which part of the code needs to be adjusted?? Any help would be greatly appreciated.
    PS,The Ostrich sample files are working fine, great work Dan!!
    Thank you

    • Hi Stu – sent you an e-mail – if you want I can take a look at the code – Dan Zen the Ostrich Doctor!

      • Hi Stu – resolved the camera movement issue – and made a correction post about it and sent you an e-mail. Hope all is well – thanks for pointing it out!!

  4. Hi Dan,
    Amazing possibilities of animations with your work.
    Working for unordinary animations for children i tried to work on your examples, i manage all but gesture where i can’t help having this message :

    hi from Gesture
    hi from OstrichCamera
    please call the OstrichCursor class
    after using an OstrichCamera.READY event
    please call the OstrichCursor class
    after using an OstrichCamera.READY event

    Newbie in programmation, i’m pretty sure my mistake is obvious. Could you help me ?

    Thanks again for all that, you’re doing great job, really helpful to see how far we can go in capture motion

  5. Hi Dan
    I’m trying to run package gesture.Camera is activated and working but the cursor does not seem.When exporting the gesture fla file does not error.
    I could not understand this situation a kind of. Any help would be greatly appreciated.I’m sorry for my English very bad.Thank you in advance.

  6. hi dan.I figured out the problem.Thank you very much. 😉

  7. Hi Dan, thanks for all your development and community work! It´s amazing.

    I saw your code, but I have no idea about as3, (I can defend myself pretty well in as2 tho..)

    I´m wandering if I could use something like:

    on (rollOver) {

    in this kind of project (with it´s proper translation to as3, of course…)

    I really would love to see this applied to scenes, or maybe moviclips… I have what I guess it´s a nice idea for this, but, I´m on the designer side of the wall…

    If you could give me any hint it´d be great.

    Thank you so much! J

    • Hmmm… tricky question. My advice would be to see if you can get the samples working following along how to get classes set up in the readme.txt. If you have a developer around, perhaps they can help although it was my attempt to write instructions so anyone could do this.

      Once you have a sample working then take a look at parts of the code that you might recognize from your AS2 days and try and do things in the AS3 class. I think it would be harder in the end to try and move all this stuff to the timeline. You can still use the code in conjunction with timeline animations, etc. For instance, instead of ball – make a MovieClip on stage as complicated as you want with timeline animations, etc. and just replace ball.x and ball.y with yourClip.x and yourClip.y and you have customized the code.

  8. Hi Dan,

    A great job but isn’t running at my end, i try to execute it , it execute but not showing the animation on box or ball, i just download the above your zip file, hope to hear from you soon.

  9. Hi Adeel,

    So you are not seeing the ball follow your motion? If you do not set up the classes correctly then it would give you an error – are you seeing an error? Do you see “hello from OstrichCam” and OstrichCursor in your output window? Are you getting the Flash Accept Camera pop up box? Thanks,

    • Thanks for your quick reply, really appreciated.
      Yes file execute perfectly in out put i got no error’s, & also camera popup comes.

      DanZen do you have any skype id or email where we do instant chat. I’m developing some interesting thing want to share some idea’s with you too.

      • Hi Adeel,

        Sorry – ran into the holidays… over which I am working on too many projects already… best of luck with it – maybe we can try and connect later on in the new year.

  10. Hi and thank you for sharing your code.

    As you said it is a bit tricky to have the clips move location, as the container of the MotionCursor stays in the initial position, even if you change clips position.

    I`m trying to find a way to dispose of the MotionCursor object for the clip, after it has changed position and then make a new MotionCursor for it in new position, but I cannot make it work.

    could you please share an example?

    • There is a dispose() method – so myCursor.dispose(); and then remake the cursor at a different location. But… what are you doing? Perhaps there is another way.


      • thanx for your answer but i`ve already tried that without any luck.

        i found the dispose function in but when i use it in function startBox for example i get Error #1006: dispose is not a function.

        based on your gesture example, i want the box clip to move when it tracks movement in an other position, with it`s cursor.

        and another thing, can we delay the cursors a bit for not get the initial camera focus movement?

        thank you again for your time!

      • Hi BoB, the dispose() method goes on your OstrichCursor object.

        private var myCursor:OstrichCursor; // up top

        And then in your constructor you use

        myCursor = new OstrichCursor(myCamera)

        Later on when you want to get rid of the cursor you go


        Then you can remake the cursor.

        However, I am still not sure what you are trying to do. If you are trying to get your box to follow the cursor when it moves then refer to the fairy example where we make a clip follow the OstrichCursor.

        The tricky part I had mentioned somewhere that you referred to was when you want your camera object to move location on the stage. Usually your camera object is stationary. Most other situations should not require remaking cursors.

        In terms of delaying the cursor to avoid initial camera focus movement, do not try and delay the OstrichCursor but rather just do not show your box or the cursor until you think it is a good time – as in set a Timer of 2 seconds or whatever and then addChild your box and the cursor if you want.

        Hope this helps – if I am still unclear on what you are doing you are welcome to describe it more…


  11. Hello, i download the code “gesture”, but when I try to compile a list of danzen errors of the library, then when I import I can now compile, but the square and the circle have no action.

    Will someone pass me a code to compile and run correctly??, thanks

    • It is good that the code compiles. Does Flash ask you permission to use the Web cam? If not, make sure a cam is installed. Also make sure that it is not open in another application. For instance, if Skype is running it will not work. Let me know how it goes.

      • Hello Dan Zen, I gave permission to the application to run, my webcam is installed and works great, no other application is running. Look this is my code and results, please watch it Dan Zen, I thank you, I do not know much AS xD

      • // hi Jorge, I see the problem – in the recent versions of the Flash player you have to wait for the camera to be ready then you can make cursors. So after the setChildIndex method in the constructor add the lines like below. This sets the listener, closes the constructor and starts the init method when the camera is ready. I did this and your example works.

        setChildIndex(myCamera, 0);
        myCamera.addEventListener(OstrichCamera.READY, init);
        private function init(e:Event):void {

  12. I really appreciate your help Dan Zen, gives me no errors and works perfect!, And I put sound xd, I want to do a virtual fitting like Zugara: D

  13. Sorry – just uploaded a latest version of this with the OstrichCamera.READY event put in place.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: