The following coding consist of two programming languages:
1. Action Script 3.0 (used for GUI creation)
2. mdm Script 3.0 (used for interfacing)
To load external images into flash
package image{
import flash.display.MovieClip;
import flash.events.ProgressEvent;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
import fl.transitions.*;
import fl.transitions.easing.*;
public class imageContainer extends MovieClip {
public var imageURL:String;
public var urlRequest:URLRequest;
public var imageLoader:Loader;
public var imageWidth:Number;
public var imageHeight:Number;
public var preLoader:Loader;
var mcImage:MovieClip=new MovieClip();
public function
imageContainer(Imagewidth:Number,Imageheight:Number,url:String) {
imageURL=url;
imageWidth=Imagewidth;
imageHeight=Imageheight;
loadThumb(url);
public function loadThumb(url:String) {
urlRequest=new URLRequest(url);
imageLoader=new Loader();
imageLoader.load(urlRequest);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,funcComplete);
function funcComplete(e:Event) {
imageLoader.content.width=imageWidth;
imageLoader.content.height=imageHeight;
mcImage.addChild(imageLoader.content);
TransitionManager.start(mcImage,{type:Fade,
direction:Transition.IN, duration:3, easing:Regular.easeIn});
addChild(mcImage);
}
}
Add event listener of “Show Detected” button
detected_btn.addEventListener(MouseEvent.CLICK, showDetected);
function showDetected(event:MouseEvent):void
import image.imageContainer;
//Loading
var im1:imageContainer=new imageContainer(178 , 198,"detected.jpg");
var ima1 = addChild(im1)
ima1.x=388;
ima1.y=319;
Add event listener of “Show Recognize” button
recognized_btn.addEventListener(MouseEvent.CLICK, showRecognized);
function showRecognized(event:MouseEvent):void
import image.imageContainer;
//Loading
var im1:imageContainer=new imageContainer(178 , 198,"recognized.jpg");
var ima1 = addChild(im1)
ima1.x=583;
ima1.y=319;
Add event listener of “shutdown” button
import mdm.*;
mdm.Application.init(this);
shutdown_btn.addEventListener(MouseEvent.CLICK, saveshut);
function saveshut(event:MouseEvent):void
{
mdm.FileSystem.saveFile("d:\\shutdown.txt", "yes");
Add event listener of “Recognize” button
import mdm.*;
mdm.Application.init(this);
recognize_btn.addEventListener(MouseEvent.CLICK, savetext);
function savetext(event:MouseEvent):void
mdm.FileSystem.saveFile("d:\\recognize.txt", "yes");
Show camera output in flash and Add event listener of “Capture” button
import mdm.*;
mdm.Application.init(this);
var cam:Camera = Camera.getCamera();
if (cam != null)
cam.setMode(300,300, 25,true);
var vid:Video = new Video(cam.width, cam.height);
vid.x=12;
vid.y=65;
vid.attachCamera(cam);
addChild(vid);
capture_btn.addEventListener(MouseEvent.CLICK, capture);
function capture(event:MouseEvent):void
mdm.Image.ScreenCapture.movieAreaToBmp(7, 60, 300, 300, "d:\\captured.jpg");
mdm.FileSystem.saveFile("d:\\captured.txt", "yes");
Add event listener of ADD button
import mdm.*;
mdm.Application.init(this);
add_btn.addEventListener(MouseEvent.CLICK, database);
function database(event:MouseEvent):void
mdm.Image.ScreenCapture.movieAreaToBmp(7, 60, 300, 300, "d:\\add.jpg");
mdm.FileSystem.saveFile("d:\\add.txt", "yes");