The readme.txt file in the download ZIP (linked to at the left) provides full instructions on installing and using the code.  Example document classes are provided.  Below is the operative code from the samples so that you get the idea.

Assuming that you import the ostrich package as detailed in the ZIP file.

private var myCamera:OstrichCamera;
private var myCursor:OstrichCursor;

public function SampleCursor() {            

 // make an OstrichCamera object and call init function when ready          
 myCamera = new OstrichCamera();    
 myCamera.addEventListener(OstrichCamera.READY, init);       


private function init(e:Event) {
 // make an OstrichCursor object (more parameters available)
 myCursor = new OstrichCursor(myCamera); 
 addChild(myCursor);     // a cursor will now follow cam motion!       


43 Responses

  1. […] available in the video link above that show Ostrich in use and discus the ActionScript code.  The code section provides a quick look at the code which is something like […]

  2. 1046: Type was not found or was not a compile-time constant: OstrichCamera.

    this error comes…

    I guess the OstrichCamera Class is not Defined.. in the .as files.

    • This usually happens if the classes are not in the class path. I usually make a classes folder somewhere – say c:/classes/ and then add that to the class path. This is the only folder I put in the class path.

      Then add com/danzen/interfaces/ostrich/ and its files to the classes folder. So in other words – you have a com folder now in classes. Then you have a danzen folder in com, etc.

      If you need help adding a folder to the class path then see the readme file that comes with the zip.

  3. […] given the Ostrich code in the beginning, I carefully analyzed and decided to edit the Ostrich Button document. I liked the […]

  4. […] given the Ostrich code in the beginning, I carefully analyzed and decided to edit the Ostrich Button document. I liked the […]

  5. hellou, i’ve peeked through your examples, and was wondering is there any way to use your constructor OstrichButton without having on stage the square of the cursor or the sprite covering it.


    • Sorry for the delay Cafrea – for some reason, I thought I was getting e-mail notification of new comments but I was not.

      You can make it so there is no cursor square by just commenting out the addChild(myCursor). Same with the button do not addChild it.

      You may want to look into making a cursor for each area that you want a button and use the MotionStart event to capture movement on that area. I do that quite a lot as it responds faster.

  6. Hola amigos estoy explorando esto de ostrich y es muy chido pero tengo un problema como hago para poner un objeto de papervicion en la camara esque me lo pone detras y solo se ve en la escena peno no en la camara pleaseeeee help

    • I am not sure how things will act with PaperVision. The OstrichCamera class extends a Sprite so it should work like any sprite. I think I had some issues when I moved or animated the OstrichCamera object so I suspect the classes are not set up for motion. It probably has to do with drawing to bitmaps and translations and stuff.

  7. Hi! first, thank you very much for Ostrich! (and I’m sorry by my poor english)

    I’m testing some uses for camera tracking, and I have a question: How can I change the camera’s resolution? If I set the camera:

    myCamera = new OstrichCamera(0,0,800,600);

    then it only scale the video, but the quality is so poor, very pixelated, something like a video of 160×120 px scaled to 800×600 px

    I searched in “” something like “cam.setMode(…)” but i can’t find it. I think you set the resolution with this lines:


    I’m lost 🙂

    I used my webcam in another aplications at 960×720 px or 640×480 px without problems..

    Can you help me?
    Thank you very much..

    mad inventor
    meets internet
    finds peace

  8. I am having a horrible time trying to get these samples to even work on my computer. I can access a webcam in flash, but i cannot open up any of the ostrich camera or mouse….. What am I doing wrong… PLEASE HELP

    I just want to learn more about how these works

    • Well… some things to check:

      1. You are using CS3, CS4 or CS5 – the class is AS3 based
      2. You have put the com.danzen.interfaces.ostrich folder in your class path (there are instructions in the zip)
      3. Where did you get to? Are you getting an error, does the accept camera message come up, etc.
      4. What platform (Mac, Win, Unix) and what browser and version?

      Let me know…

      • I have cs4 and cs5 both as3

        i have made a folder named classes… went to the reame.file in the zip.. i upload the classes file through the edit button. I put the com folder then in the classes folder.

        When i try to open the sample cursor it says access denied…

        I open the fairy file and past in the code in as from the code in fairy but when i open it up… I just get the picture and a glowing fairy.

        i figured if I can open up the samples i will be able to open the files in other files I make.i am a beginner, but a very faster learner…. I how this might help.. Please help I have a project I wanted to use this on…

  9. Make sure you unzip the files.

    Also, you need to add that classes folder to your class path in Flash. So open the FLA and follow the instructions in the readme about setting your class path. This tells Flash where to automatically look for extra code – like Ostrich.

    Oh… there is no reason to paste in any code. There is a connection in the FLA file in the properties panel when you click on the stage. The connection tells flash where to look for the code something like: samples.Fairy. Then the code in the file will run. And if you set up your class path correctly, the import command at the top of will call the code from the Ostrich classes.

    So it should just work without you doing anything but making sure the com folder is placed in a folder that is in your class path (classes for example once you set it).

    • I’m sorry I hate to keep taking up your time…. this is what i have so far fresh start… download the the zip file… unzip the file… i created a folder called classes on the desktop… add the folder by going to in flash(cs4_as3.0) edit_preferences_ actionscript_3.0settings_sourcepath_+c:\users\myname\desktop\classes….. from there i put the com folder…. when i open the fairy folder nothing happens…

      if there is some simple code is there anyway you can email me or talk with me.. I’m more than willing to donate…. I know your helping I’m just not getting it…


      • The first part sounds good. When you added the com folder I assume that the danzen / interfaces / ostrich folders were also in there as well as the Ostrich files.

        There is no fairy folder though… there is a fairy.fla and that is what you need to run – to see that example and then go – but I assume you know that…

        The simplest code to try possible in AS3 is the sampleCursor.fla – just open it in Flash and ctrl enter and you should see the request to access the camera and then the camera with a little square that follows the motion.

        Also – just so I know, are you on Mac or PC?

        Don’t worry at all about asking questions 😉

      • I am on a PC…. Well after I wrote that last post I was able to get all the samples to work, but the samplecursor…. when I try to open the file it say… unexpeccted file format and closes when i push “ok” because i have too…. Now my next step is trying to get them in some type I code I make…. I have tried but nothing happens… just wonering if you might have some helpful tips… Sorry I’m a noob

      • Hmm… I checked the download zip and sampleCursor works for me – perhaps try downloading and unzipping again.

        With respect to further coding… it would be difficult to help you, not knowing your background, etc. and there are time issues. Perhaps have a read of a document that I made a while back that tries to help new coders get an idea of what it is about.

  10. Hi Dan , is there any way to make te cursor faster.
    thank you . ostrich rulez!!

    • Hi Arturo,

      You can make the cursor go faster by adjusting the responsiveness to 1 when you create your OstrichCursor. This will mean it tries to place the cursor every frame as opposed to 4 (the default) where it waits and averages over 4 frames. One drawback is that it might appear jumpy. If you are just needing quicker response in motioning over places then consider using a cursor for each of your places and using the MOTION_START event to capture when there is motion on the cursor. This is the most responsive way to handle a button like feature for instance.

      new OstrichCursor(theCam:OstrichCamera, theL:Number=0, theT:Number=0, theR:Number=0, theB:Number=0, theResponse:Number=4)

      for example: (the 0s will make it default to whatever your camera size is and the 1 is very responsive:

      new OstrichCursor(myCam, 0, 0, 0, 0, 1)

  11. Oh i see thanks .
    I’m using 6 sprites i think, i’ve to use 6 ostrich cursor each one with it’s own limmits (x and y).

  12. hi dan,
    i have a little problem , I have 6 sprites and 6 cursors (each one with it`s own area ), and when i use the aplication they move a lot so… i tried putting an initial position(x,y) before the addChild(cursor) and another position(x,y) in the over event(to make them move after the event), but it doesn’t work. is there any suggestions?.
    thank you very much.

    • Hi Arturo,

      Not quite sure what you mean by they move a lot. Are you saying they move when there is no motion? If there is motion in their area, then they should move.

      Also, you may find that it is easier to control your own clips rather than trying to control the OstrichCursors. Just do not addChild the OstrichCursors and then set your own cursors to the OstrichCursor x and y when you want to. If you try and set the x and y of the OstrichCursors, they will just be set by Ostrich.

      Not sure if this helps – but you are welcome to describe the issues again.

      • Sorry about my bad explanation, I know that my English is bad, the problem I have is that cursors activate the sprites like I want but they are a little jumpy and sometimes they activate the same sprites more than once. That’s why I’ve tried to reset the x and y after the over() event , and when I start the application all the cursors jump everywhere for a couple of seconds and some sprites are activated even if there’s no movement of the person who start the application.

        Here’s the Url of my finale college project. Well it’s the beginning, my sister lend me her server for my application so I can show you. With this I think you’ll see what my problem is.

        Thank you very much and sorry for so many questions Dan.

  13. Hmmm… the project looks pretty cool.

    I can’t make it work for some reason – yet my ostrich examples are working so I am not sure – are you sure it is working as posted? I do see the orange balls go to the various places but that’s it.

    Here are some suggestions:

    People usually need to see where they are on screen to make gestures work – so perhaps just keep a faded (alpha = .2) camera visible to them.

    If you set regions for your cursors that are right on the buttons, you will not need balls following your movement. Just use the MOTION_START and MOTION_STOP events to activate the buttons when there is motion on the button area.

    Hope this helps.


  14. Thank you very much Dan , that was the solution , It Works !!!!.
    the solution was the MOTION_START and MOTION_STOP events instead of the over event.
    I don’t know why you couldn’t see yourself in the webcam , your right people need to see their bodies when they use the application.
    everything works fine but I found another problem, It works when I use my computer but it doesn’t work in my friends computers. hmmm the only different between them is that I have windows vista, they have Windows 7 and the last version of Chrome and Firefox. When they use the application all the buttons activate without movement.
    Well i hope it solve, i’m working on, if you have any suggestion i’ll appreciate it .
    Thank you very much Dan , I learn a lot working in this project an using ostrich !! you rock!

  15. olá, sou novato nessa area, estudo design de produto
    e achei muito interessante realidade aumentada.
    sou do Brasil, estou com umas duvidas, como sei pouco
    de actionscript não estou conseguindo acrescentar mais botões !
    como eu faço?
    outra pergunta é como troco a imagem do botao quadrado para outra figura?

    muito obrigado desde já amigos!!!

    • Oi Rodrigo,

      Eu aplologize para o atraso.

      Você pode adicionar mais botões, tornando OstrichButtons novos assim como a amostra, mas chamá-los button2, etc

      Ou você pode fazer objetos OstrichCursor novos em locais específicos e capturar um evento MOTION_START em cada um como um capotamento.

      Para alterar a pracinha do cursor, você teria apenas que não addChild o cursor e colocar o seu próprio Sprite ou MovieClip no x e y do cursor. O exemplo de fadas faz isso.

      Tudo de bom,


  16. hi.. i tried it first and it works. when i try to make my own, i forgot the steps and now, the message “the package bla bla bla does not reflect the location”.. i follow the read me.. but i am not fond of action scripting.. I want to do this for my college project,, >.< any help?


    • Sorry Mellisa for the delay – for some reason I missed these messages. I am not sure I can tell you more clearly than in the readme.txt about packages, etc. Perhaps have another read over it or maybe get a colleague to help you. If you got the samples to work, you can always make your project in the same folder as a last resort. All the best – if you still need help, please message back and I can try and help further.

  17. Hello! I’m using flash cs3 on PC Windows and follow the steps to insatalar ostrich, but when you run the Fainy.Fla I get an error “unexpected format” I need help please. Thank you.

    • Hi Hernan,

      If you are not using ActionScript 3 then the latest version of Ostrich will not work. I do have a zip file of Ostrich before it was Ostrich. It was called VideoMotion and ran on ActionScript 2. So you can try that. It is timeline code based: I provide it as is and would rather not have to look back at the code to explain anything 😉

  18. Hi Dan,

    I just downloaded your file, made the “classes” folder, copied the com folder over, and edited the path. So far, so good 🙂 The problem is that I can`t get the camera to work when I test the .swf – I get the “trace” message in the output, indicating that it works, but nothing happens. I would really appreciate your help 🙂 Best regards…

    • Sounds frustrating – sorry. Usually when this happens it is because the camera is open somewhere else like in the software that comes with the camera or skype, etc. Please check that and let me know. Are you on a mac or pc?



      • That was fast, thanks! 🙂 I`ve checked, and the camera is not open somewhere else. I am using a PC. I`m hoping to be able to use this in a project, so any help is great, thank you Dan!! 🙂

  19. Are you trying one of the examples – please try the Sample Cursor one and verify that you see this in the trace window:

    hi from OstrichIcon
    hi from SampleCursor
    hi from OstrichCamera
    hi from OstrichCursor

    You should see something pop up asking you if you accept the camera request – did you see that?

    Perhaps as well try my online example and tell me if you see the message asking to accept the camera:

    Another thing to perhaps try is see if you can just get the camera feed to show up in a basic flash example. I don’t have time right now to write the code for that – should just be a couple of lines, you can probably find examples online. If you can’t get that to work then something peculiar is going on with your setup. Have you made sure the camera is working with, for instance, the software that comes with it – of course remember to exit out of that software – make sure no video chat is automatically going, etc.

    • I can`t open the “samplecursor” fla, I get an error, “unexpected file format…” although, when I try to open any of the other examples, I only trace “hi from OstrichIcon” – so it`s probably something I`m not doing right?

      I also made another webcam fla, and that works fine, same for your online example. It seems like there is no code that triggers the camera, since I don`t get the “allow/deny camera” message…

  20. Ah… perhaps I edited the samplecursor.fla in CS5.5 and the others in CS5 or CS4 – what Flash are you using? If you are not getting the other traces then I expect it is a class path issue – although there should be an error as you run it if it is a class path issue.

    If you put the com folder in the classes folder then you want to make sure your class path is set to the classes folder, not the com folder. Check the readme for more on setting the class path. You did say you set the path so forgive me if you already know this stuff. 😉


  21. HI!, this project it’s amazing!, i just came here to ask one question: how can i “turn off” the OstrichCamera after use?, i mean if i want to make another call to the class, but at the start initialize on NO_CAMERA, or something like that. thanks in advance!

    • Hi Lalo,

      Not sure if I have tried it yet but I did provide dispose() methods so you would say myCursor.dispose() and myCamera.dispose() if those were the names of your instances. Let me know if that works, if not, I will think further. Thanks for the “amazing” comment!

      • Oh man!, totally works!, the only tricky fo the “Turn Off the Camera” was to put another “Camera Object” but “null”… something like: var disabled:Camera = null; and finally at the dispose function place this: cam.attachCamera(disabled); and you’re ready to go! i like to donate, don’t surprise if you see some extra money in your paypal account!

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: