Finally I got time to test KunerLite plugins. They have done 11 nice plugins to extend Flash Lite applications. Now I am going to test a few of them and write some lines here in my blog.
My first test is to do Flash Lite application which takes pictures and sends those to server side. This testing application sends pictures to my server http://ptm.fi/temp folder, so check you uploaded photos from there.

Setting up system
I recently reinstalled Windows again, so I have to install Active Perl and Symbian S60 3rd edition SDK Maintenance Release back to my computer to get KuneriLite working. You can find all necessary information’s from KuneriLite Wizard Beginner's Guide (they have done excellent wiki for you which helps setting up KuneriLite to your computer). After Perl and S60 SDK is ready in your computer, you have to install KunerLite, you can download free Basic version from Kuneri’s web site.
Flash Lite application
The idea of application is to take picture and send it to server side. I decided to program Flash Lite 2.0 application because I don’t want to mess with old Flash Lite 1.1 code anymore
. All code is written to first frame of timeline, I will describe here only needed lines to understand taking and sending picture to server side. Please see source code for more information.
Initialize application
A few variables are defined to handle picture name and KuneriLite plugin gateway errors. I have made small delays between taking/storing picture, making thumbnail and loading thumbnail because you have to wait a little time to get picture ready to resize or loading. These processes are handled with process and intervalId variables and setIntervals. Pictures and thumbnails are stored in application installation directory.
var picName:String = "";
var klError:Number = -99;
var process:Number = 0;
var intervalId:Number;
var path:String = "\\Data\\Others\\Trusted\\PTMCamera\\";
Taking picture
When user press mobile phones number one key, a new mc is created to store and show picture’s thumbnail. KuneriLite uses loadVariables()-function to call Camera plugin to take picture. You can find more information about Camera plugin from their web site. Here I just take full size picture with main camera.
/* take picture */
function takePicture(){
// create new mc to display new image
if (image_mc != undefined) {
removeMovieClip(image_mc);
picture_txt.text = "";
}
this.createEmptyMovieClip("image_mc",this.getNextHighestDepth());
image_mc._x = 40; image_mc._y = 105;
picName = giveDateAndTimeString();
var command:String = "";
command += "http://127.0.0.1:1001/Basic/camera?klCommand=start";
command += "&klMode=picture";
command += "&klPath="+path+picName+".jpg";
command += "&klSize=full";
command += "&klIndex=0";
status_txt.text = "status: taking picture...";
bottom_mc.image_txt.text = "";
process = 1; klError = -99;
loadVariables(command,"");
}
Making thumbnail and show it to user
After picture is taken it will be resized and loaded to Flash Lite application. You can resize pictures with KuneriLite Camera plugin and load pictures with MovieClipLoader.
/* make thumbnail */
function resizePicture() {
clearInterval(intervalId);
var command:String = "";
command += "http://127.0.0.1:1001/Basic/camera?klCommand=resize";
command += "&klPath="+path+picName+".jpg";
command += "&klSize=160*120";
command += "&klTargetFile="+path+picName+"_thumb.jpg";
status_txt.text = "status: resizing picture...";
process = 2; klError = -99;
loadVariables(command,"");
}
/* load picture */
var mcLoader:MovieClipLoader = new MovieClipLoader();
mcLoader.addListener(this);
function loadPicture(){
clearInterval(intervalId);
status_txt.text = "status: loading thumbnail...";
mcLoader.loadClip(picName+"_thumb.jpg",image_mc);
picture_txt.text = picName+".jpg";
}
function onLoadError(mc:MovieClip) {
status_txt.text = "status: error loading thumbnail!";
}
function onLoadComplete(mc:MovieClip) {
status_txt.text += "done!";
}
Sending original picture to server side
Sending is very similar process, just call KuneriLite Upload plugin and it sends picture to server. In server side you have to use for example PHP to get and store picture (you can find example PHP code from Kuneri’s web site). Remember give write permission to folder where images will be uploaded.
/* send picture */
function sendPicture(){
var command:String = "";
command += "http://127.0.0.1:1001/Basic/uldl?klCommand=upload";
command += "&klTrId=1234";
command += "&klUrl=http://www.ptm.fi/flashlite/kuneri/getImage.php";
command += "&klFile="+path+picName+".jpg";
command += "&klType=image/jpeg";
status_txt.text = "status: sending picture...";
process = 3; klError = -99;
loadVariables(command,"");
}
There are also function which handles user interactivity with mobile keys and function which just check processes what is happening in Flash Lite application and updates dynamic status textfield. Please see those in source codes.
Creating SIS-file
You can create SIS file with KuneriLite Wizard. It is very easy process – create project, select plugins, add files to your project and finally create SIS file. I have made own cer and key files with makekeys command. More info to sign SIS files can be found for example from Adobes site.

Source and SIS files
This application is designed to run 240x320 screens and for testing purposes only. It uses KuneriLite’s default generated UID in SIS package.
Sources: PTMCamera.zip (Flash Lite 2.0 Application)
SIS: PTMCamera_3rd_edition_signed.sis (install it to phone memory)
It is amazing easy to do this kind of application with KuneriLite plugin’s, thanks to all KuneriLite team members!