Archive for the 'Tutorials' Category

How to Photograph your user

How to Photograph your userAfter my first four semesters as an art major using mostly digital media, it was pretty apparent that I was going to be a web designer when I grew up but I wanted more, I wanted to program, I wanted to learn… Actionscript! While trying to come up with an idea for a senior semester project Flash MX was released. One of the major changes in this release was the ‘Settings…’ menu (found by right clicking [PC] or control clicking [MAC] inside a Flash movie). Settings menu choiceThis menu selection brings up a Flash player settings window that includes the camera and microphone permissions settings. The user can allow their computer connected camera and/or microphone to be accessed via Flash player. What does this mean? Flash Communication Server was not released at first and the camera and microphone features were not listed in any Flash manuals when MX debuted, so I wandered bookstores for weeks looking through Flash books and trying to find the hidden camera and microphone setting meaning.Flash Movie settings window Then inside the Macromedia Flash MX 2004 Actionscript Bible the Camera() object was finally defined. This object allows Flash to access and control a user’s camera in order to facilitate teleconferencing using Flash Communication Server, plus it can even detect motion. The only thing the Camera() object doesn’t seem to do is take ‘still’ photos.
Still photos could allow the developer to add their user to an animation or game and thereby enhance the user experience. But how? First you acquire the camera using the Camera.get() method. This allows the Flash file to access the camera directly.Flash attached camera settings This method with return null if the user has disabled access via the settings menu. If the user has not ever set the access settings for the specific Flash file or web site, they will be prompted on load of the file to either give access to their camera or not. I recommend warning the user way ahead of time that their camera will be accessed. Now you can attach the accessed camera to a Movie Clip in your Flash movie and then animate and adjust the movie clip via Actionscript.Grabbed picture Now you are ready to access an undocumented feature via a camera disconnection. Setting the attached camera null leaves a residual image of the last frame grabbed. Why is the feature undocumented? We can only wonder at Macromedia’s ways, but never question…
Click through for a sample photo movie (remember to enable your camera) and a code snippet of what you will need to enable the still photo capability. I do not have Flash communication server and do not say any image associated with the movie.
If you use this in one of your Flash projects please link to my site and give credit where it is due, thanks.
Continue reading ‘How to Photograph your user’