By Felipe Sampaio
This post shows the development of a version of the famous Jokenpo game (stone, paper and scissors). To play this game is needed two players, so it was developed using Bluetooth to connect two mobile phones. As Flash Lite doesn’t provide a Bluetooth API until now, the game was developed with the Kuneri Lite to provide the Bluetooth connectivity.
This picture shows the first screen of the game

The player presses the ‘Play’ button, then the game will start and search for adversaries (mobile phones) that has already been started too. If the connection is estabilished the below screen is shown, if not a message error is shown.
The player has a time to choose an option, after this time the game will choose the selected option.

After the two players choose their options, the game will announce the winner. The next screen shows if the player won or lost.

After few seconds the game goes to the next screen, in this screen the player can quit the game or play again.

To download the source code of this application, click here.
By Marcos Fábio
There are many screen resolutions for mobile devices, it makes the development of graphic user interface more difficult than should be. Many languages provide a lot of components for build graphic interfaces easily, like J2ME, PythonS60 or WRT. A set of components is a Kit for development of graphic user interfaces.
In Flash Lite there is no Kit for the development of graphic user interfaces. Normally the developers use the Flash native components, but they are made for web or desktop and they are so much heavy for mobile devices.
In this post is proposed a Flash Lite Kit for development of graphic user interfaces. Follow will be showed the basic features of this kit, the download of the first beta release and how to use it.
Basic Features
- It has to work in many screen resolutions.
- Details as color, font and format must be configurable.
Basic Components
In the first beta version of the Kit, two components were developed (TextBox and Button); they are the only components available in this version.
Future Releases
In future releases more and more components will be added and existing components will be upgraded. This version is just a proof-of-concept of the Kit.
How to Install and Use
The Kit consists of a set of Action Script classes that must be imported in a Flash Lite project (It can be downloaded here). After imported, the use of them is very simple, as shown below:
import flkit.components.ui.*;
//Creates two instances of TextBox UI component of the Flash Lite UI Kit
var tx1:TextBox = new TextBox("tx1","FirstName","");
var tx2:TextBox = new TextBox("tx2","SurName","");
//Creates two instances of Button UI component of the Flash Lite UI Kit
var bt1:Button = new Button("bt1","send");
var bt2:Button = new Button("bt2","load");
//Defines the event when a click on button SAVE occurs
bt1.onClick = function(){
trace("click on button SAVE");
}
//Defines the event when a click on button LOAD occurs
bt2.onClick = function(){
trace("click on button LOAD");
}
//Creates a new UIManager, this is the base class of the Flash Lite UI Kit. All UI components must be in this instance.
//The constructor parameter is the MovieClip where all components will be added.
var uiManager:UIManager = new UIManager(_root);
//Adding all UI components
uiManager.addUIComponent(tx1);
uiManager.addUIComponent(tx2);
uiManager.addUIComponent(bt1);
uiManager.addUIComponent(bt2);
//Builds the graphic interface
uiManager.build();
This code produces the same effect in two different screen resolutions, as shown in the pictures below.


By Felipe Sampaio
Hi all,
In this post we’ll see how to use accelerometer in Flash Lite with Kuneri Lite. We’ll do a small example of the moving ball application, however simpler than the original application.
First of all, you have to create two layers, with names ‘content’ and ‘actions’. After this, create a movieclip with a circle like the showed below. Put the movieclip in the Stage with an instance name ‘ball_mc’.

After this, put the below code in the first frame of the ‘actions’ layer.
//Set fullScreen
fscommand2("FullScreen", true);
var lv:LoadVars = new LoadVars();
var X, Y, acelX, acelY, posX, posY;
//Reset the kuneri Lite variables.
klXAxis = 0;
klYAxis = 0;
lv.onLoad = function(success:Boolean){
if(success)
if(lv.klError == 0){
//Read the position.
lv.load("http://127.0.0.1:1001/Basic/accelerometer
?klCommand=readsensor");
X = lv.klXAxis;
Y = lv.klYAxis;
}
}
onEnterFrame = function():Void{
//Calculate the respective constant acceleration.
if(X > 0)
acelX = -1;
else acelX = 1;
if(Y > 0)
acelY = -1;
else acelY = 1;
posX = Math.abs(X/10) * acelX;
posY = Math.abs(Y/10) * acelY;
moveBall(posX, posY);
//Verify the limits of screen.
verifyPosition(ball_mc._x, ball_mc._y);
}
function verifyPosition(posX:Number, posY:Number):Void{
if(posY <= 10)
ball_mc._y = 10;
if(posY >= 310)
ball_mc._y = 310;
if(posX <= 10)
ball_mc._x = 10;
if(posX >= 230)
ball_mc._x = 230;
}
function moveBall(posX:Number, posY:Number):Void{
ball_mc._x += posX;
ball_mc._y += posY;
}
//Start the accelerometer, before first read.
lv.load("http://127.0.0.1:1001/Basic/accelerometer?klCommand=startsensor");
stop();
In this example the acceleration is constant, because this is a simple example for to create a moving ball with Flash Lite using KuneriLite accelerometer plugin by Flash Lite.
Download
By Marcos Fábio
In this post we’ll show a Flash Lite application which access S60 internal resources using PyS60.
This is done using the architecture and implementation showed in the following post.
Like was showed in the post, a client application has access to S60 internal resources throught HTTP requests. In ActionScript 2.0 (which is used in Flash Lite 2.x and 3.x) a HTTP request can be executed using the LoadVars class. The basic use of this class is showed below:
var lv:LoadVars = new LoadVars();
lv.onLoad = function(success:Boolean){
//Actions when data is loaded.
}
lv.sendAndLoad("http://example.com",lv,"GET");
The parameters of sendAndLoad method are:
- “http://example.com” - The url from which will load the data
- lv - Object with the data to send to the URL
- “GET” - The method to send the data, can be “GET” or “POST”
We’ll use this class to access S60 internal resources when using the code showed in this post
to access this S60 resources.
In the below code we show how to access the GPS position using this solution.
//Fullscreen
fscommand2("FullScreen",true);
//Create the load vars variable
var lv:LoadVars = new LoadVars();
//Create a MovieClipLoader object to load the google static map
var loader:MovieClipLoader = new MovieClipLoader();
//Generate a API_KEY and set here.
var apiKey = 'ABQIAAAAJq0bIh_b5seBuaS5dG3MyBTgIMgsbASCAp5eBSzKUN4OpxTWjxQe25ul58fmeLTrIy1RiBxMJ2gJ5w';
//When the GPS position is retrieved. The following method is called.
lv.onLoad = function(success:Boolean){
if(success){
//Set the UI components with the retrieved data
//The retrieved data when you're accessing 'get_position' service are the 'latitude' and 'longitude' of the device.
latitude_txt.text = lv["latitude"].substring(0,8);
longitude_txt.text = lv["longitude"].substring(0,8);
var url:String = 'http://maps.google.com/staticmap?¢er='+trim(lv["latitude"].substring(0,8))+','+trim(lv["longitude"].substring(0,8))+'&zoom=10&size=220x200&maptype=mobile&key='+apiKey;
//Load a map with your position in the center
loader.loadClip(url,map_mc);
}else{
trace("Error");
}
}
//Start the work when press the 'LOAD MAP' button.
loadMap_btn.onPress = function(){
//The url gived in sendAndLoad method has access to the self device (127.0.0.1, to the port 5004 (This is the default port of the ServerPython) and the service 'get_position' (Retrieves the GPS position of the default module)
lv.sendAndLoad("http://127.0.0.1:5004/get_position",lv,"GET");
}
Remember that you have to start ’spython’ application before the Flash Lite access S60 resources.
Click here to download the complete example.
By Felipe Sampaio
With this new release of the S60 platform, Flash Lite Developers will have greater access and control of native functions of the device, it allows development of more complete and efficient applications. Follow the list of new supported functions.
Until now, no specific API was released. But, for more information about S60 5th edition, click here. (must be registered.)