Sunday, March 14, 2010

Simple Camera Capturing using Action script 3





package
{

import flash.events.*;
import flash.media.*;
import flash.text.*;
import flash.display.*;

public class SimpleCamera extends MovieClip
{
private var camera:Camera;
private var mic:Microphone;

public function SimpleCamera()
{
ok.addEventListener(MouseEvent.CLICK,Play);
ok2.addEventListener(MouseEvent.CLICK,Stop);
}

public function Play(event:MouseEvent)
{
camera = Camera.getCamera();
mic = Microphone.getMicrophone();
videoCamera.attachCamera(camera);
}

public function Stop(event:MouseEvent)
{
videoCamera.attachCamera(null);
}

private function activityHandler(event:ActivityEvent):void {
trace("activityHandler: " + event);
}
}
}

Simple application using Timer in Action Script 3




package
{
import flash.display.Sprite;
import flash.events.TimerEvent;
import flash.utils.Timer;

public class TimerClass extends Sprite
{
var _square:Sprite;
var _circle:Sprite;

public function TimerClass()
{
_square = new Sprite();

_circle = new Sprite();

_square.graphics.beginFill(0x660033);
_square.graphics.drawRect(0,0,100,100);
_square.graphics.endFill();

_circle.graphics.beginFill(0x660033);
_circle.graphics.drawCircle(50,50,50);
_circle.graphics.endFill();

addChild(_square);
addChild(_circle);

_circle.x = 200; // xy postion
_circle.y = 200;

_square.x = 100; // xy postion
_square.y = 50;

var sqTimer: Timer = new Timer(50,0);
sqTimer.addEventListener(TimerEvent.TIMER,SquareTimer);
sqTimer.start();

var cTimer:Timer = new Timer (50,0);
cTimer.addEventListener(TimerEvent.TIMER,CircleTimer);
cTimer.start();

}
public function SquareTimer(event:TimerEvent):void
{
if (_square.x <=150)
_square.x++;
}
public function CircleTimer(event:TimerEvent):void
{
if (_circle.x >=150)
_circle.x--;
}
}
}

Memento Design Pattern






The classes and/or objects participating in this pattern are:

Memento (Memento)
stores internal state of the Originator object. The memento may store as much or as little of the originator's internal state as necessary at its originator's discretion.
protect against access by objects of other than the originator. Mementos have effectively two interfaces. Caretaker sees a narrow interface to the Memento -- it can only pass the memento to the other objects. Originator, in contrast, sees a wide interface, one that lets it access all the data necessary to restore itself to its previous state. Ideally, only the originator that produces the memento would be permitted to access the memento's internal state.
Originator (SalesProspect)
creates a memento containing a snapshot of its current internal state.
uses the memento to restore its internal state
Caretaker (Caretaker)
is responsible for the memento's safekeeping
never operates on or examines the contents of a mem

Sunday, November 1, 2009

The Wrist Keyboard




Completely sealed, it can operate in the rain and other harsh environments. A curved back provides a secure and comfortable placement on the wrist. The keyboard layout is optimized to provide alphanumeric entry. Carefully positioned arrow keys ease menu-oriented tasks. The WristPC keyboard comes with an optional wrist strap to provide the capability of attaching it to your wrist.

Optimus Keyboard





Each and every key on the Optimus Keyboard is a stand-alone display that shows you exactly what it is controlling at the very moment.