BTA Flexing

My passion RIAs…………..Shardul Singh Bartwal

Archive for the ‘AIR’ Category

Getting Vibration On Android base mobile using Native extension for Adobe AIR

Posted by shardulbartwal on March 4, 2012

I hope you all will be aware of the Native extensions in the Adobe AIR.You can check the official link for the same by adobe.

http://www.adobe.com/devnet/air/native-extensions-for-air.html

I have implemented the usage of the native extension for achieving the vibration in adobe air mobile application.As there is not a default API in adobe air to achieve this.So I have used the native extension i.e. (ANE file) for this.Things are working superb on my Samsung Galaxy.

Instead of repeating things I will like you to visit:-

http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/vibration.html

You will see the step by step implementation with the source code there.

Shardul

Posted in Adobe AIR 3.0, AIR, Flash Builder 4.6, Mobile Applications with Adobe AIR | Tagged: , | 3 Comments »

Adding a device simulator(emulator) to Flash Builder 4.6

Posted by shardulbartwal on March 4, 2012

If you are having one such device for which you are planing to make the mobile application and you are not having it by default in the list of emulators in Flash builder 4.6.At that point you can just add your desired mobile to the list of emulators.It can be just achieve by the couples of mouse clicks.Simply go to the Window>Preferences>Flash Builder>Device Configurations
And click on the “Add” button. Then fill the detail of the your preferred mobile set.Attaching the screen shot.

add device emulator to Flash builder 4.6

After applying the settings you will be see this on the list of the emulators and you can use this.

Hope this will help someone……………………….

Posted in ActionScript 3.0, Adobe AIR 3.0, AIR, Flash Builder 4.6, Mobile Applications with Adobe AIR | Tagged: , , , , , | 1 Comment »

Using charts inside Mobile Applications with Adobe AIR

Posted by shardulbartwal on January 30, 2012

I was in a big doubt since very long time,I was waiting for the new version of the Charts under the Spark Components,so that I can use them inside the mobile applications.But I was surprised also that why there is nothing for this in the Spark components.But Yesterday I just checked with the MX Charts components in my mobile application for a demo on my Samsung mobile,and things were working excellent and smooth.Was happy and surprised also that how is it is it possible?. Later on started to search on the net for this.And found it on my first click.It was clearly mention there at http://www.adobe.com/devnet/flex/articles/mobile-development-flex-flashbuilder.html#articlecontentAdobe_numberedheader_1 by Narciso Jaramillo long long ago that:-.

Charts are supported in mobile projects, but other MX components are not. We don’t recommend using MX components in mobile projects; use the Spark components instead. The one exception is the charting components, which are usable in mobile projects if care is taken to avoid displaying or animating too much data at once.

So finally I have to made myself satisfy with ‘Better late than never.’
Hence sharing it,hope this can help someone.

Keep Rocking………..

Posted in ActionScript 3.0, AIR, Flash Builder 4.6, Flex, Mobile Applications with Adobe AIR | 4 Comments »

Official Flex User Group Tour date announcement started by Adobe

Posted by shardulbartwal on January 29, 2012

Its nice to see that adobe has started their International Flex User Group Tour
to discuss their last year ends announcements about Flex and Flash Platform.They
have announced the dates for the North America.

Schedule can be checked at:-

http://blogs.adobe.com/flex/2012/01/announcing-flex-user-group-2012-tour-north-america-dates.html

Waiting for the turn of Asia including India.

Enjoy Flexing…….
Shardul

Posted in ActionScript 3.0, AIR, Flex, Flex 3.0, Flex 4 | Leave a Comment »

Selected tab skining in Flex 3 Tabbar

Posted by shardulbartwal on November 22, 2010

I was trying to skin the tab-bar in flex 3.Was facing some issue,as I dot find any particular property for skinning the selected tab,although there is a property ‘selectedTabTextStyleName’ for the style of the selected text. But ultimately it is done.Below is the code for the skinning of the selected tab of the tab-bar hope you will find it worth of your purpose.Below is the same code. Please feel free to give your idea if you have done this by any other way.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
	 layout="vertical">
<mx:Script>
	<![CDATA[
		import mx.collections.ArrayCollection;
	
	         import mx.controls.tabBarClasses.Tab

		[Bindable]
		private var arrayCollection : ArrayCollection = new ArrayCollection([
		{lbl:'Football'},
		{lbl:'Cricket'},
		{lbl:'BollyBall'}
		])
		
		private function setTabSkin():void
		{
		  var tab:Tab = tabBar.getChildAt(tabBar.selectedIndex) as Tab;			  
		  tab.setStyle("fillColors", ["#0xBBBBBB", "#EEEEEE"]);
                  tab.setStyle("backgroundColor", "#999999");
                  tab.setStyle("borderColor", "#000000");
                  tab.setStyle("themeColor", "#222222");
		}
	]]>
</mx:Script>
	<mx:TabBar id="tabBar" itemClick="setTabSkin()" selectedIndex="0" creationComplete="setTabSkin()" dataProvider="{arrayCollection}" labelField="lbl"/>

</mx:Application>

Posted in AIR 2.0, Flex 3.0 | Leave a Comment »

Reading File names inside a folder in Adobe AIR

Posted by shardulbartwal on October 31, 2010

Reading the file names(including the folder names) in adobe air is a straight forward task.You have to decide the folder location i.e. desktop,document or application folder etc. And then you can get the file listing of that folder very easily. As I have done for a folder which is on my desktop.Below is code for the same.

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
	creationComplete="getFolder()">
	<mx:Script>
		<![CDATA[
			private function getFolder() : void
			{
				var dir : File = File.desktopDirectory.resolvePath("MyFolder");
				dir.getDirectoryListingAsync();
				dir.addEventListener(FileListEvent.DIRECTORY_LISTING,onDirectoryListComplete);
			}

			private function onDirectoryListComplete(event : FileListEvent) : void
			{
				var cont : Array = event.files;
				for (var i : uint = 0;i<cont.length;i++)
				{
					trace(cont[i].name + "....." + cont[i].size);
				}
			}
			
		]]>
	</mx:Script>
	
</mx:WindowedApplication>

Posted in AIR | 5 Comments »

Moving Adobe AIR Application

Posted by shardulbartwal on October 18, 2010

Moving any air application is already provided feature with any air application if you are having title bar with it.
But let suppose you requirement is such that you dont require to show the title window.In that case if you want to
move your window with mouse on the any particular Display object then you can acheive this some thing like this.
Just call two function on that partiuclar display object the one for moving the application and another for stoping this
moving.Like below:-

private function onMouseDown(event : MouseEvent) :void
{
this.stage.nativeWindow.startMove();
}

private function onMouseUp(event : MouseEvent) : void
{
this.stage.nativeWindow.restore();

}

I am using there this word as I m currently inside the WindowedApplication.

Hope you will enjoy this…….

Posted in AIR | 3 Comments »

Creating Transparent Application Window in Adobe AIR

Posted by shardulbartwal on October 7, 2010

Acheiving this is very simple. You need to made two changes in the YouApplicationName_app.xml by setting systemChrome and transparent properties.

<initialWindow>
<systemChrome>none</systemChrome>
<transparent>true</transparent>
<initialWindow>

And inside your WindowedApplication you have to set these four properties:-

backgroundAlpha=”0″
showTitleBar=”false”
borderStyle=”none”
showStatusBar=”false”

Thats all and you will achive this.

Enjoy……..

Posted in AIR | 1 Comment »

Getting Ethernet Adapter(MAC Address in AIR Applicaion)

Posted by shardulbartwal on October 3, 2010

Its very simple and easy to get the MAC address of any computer with Adobe AIR application.

With just two to three lines you can find it very easily.Just have a look at lines below
and you will get the MAC address of the computer in which your application is running.

var networkInterface : Object =  NetworkInfo.networkInfo.findInterfaces();
var networkInfo  : Object = networkInterface[0];
var physicalAddress : String = networkInfo.hardwareAddress.toString();

Hope you will like it…………

Enjoy Flexing…….

Posted in AIR 2.0 | 7 Comments »

Adobe AIR and SQLite Connectivity

Posted by shardulbartwal on April 14, 2008

Adobe AIR and SQLite Connectivity

 ===========================

  Abode AIR provides very easy mechanism to connect to the SQLite.I am doing the connectivity by coding. Here nothing different just create the connection and create the SQLConnection,open it, create SQLStatement and execute them, close connection.Upto my experience I think this is the same common way which we used in any database connectivity. So there is nothing special. I found this process very cool especially due the portable size of the SQLite and creating and deleting the database in just one mouse click. Apart form this you don’t require any thing else Flex Builder IDE with AIR. There is no software requirement for the SQLite.

 I am just putting some line of code for your better understanding. You can just copy and paste it. Although Its just a small code but hope it will give you the over all idea about dealing with the database in an AIR application.

 

*************************************************************

<?xml version=”1.0″ encoding=”utf-8″?>

<mx:WindowedApplication xmlns:mx=”http://www.adobe.com/2006/mxml

layout=”vertical” creationComplete=”init()”

width=”500” height=”400” backgroundColor=”#000000>

<mx:Script>

 

<![CDATA[

      import mx.controls.Alert;

      import mx.collections.ArrayCollection;

      import flash.data.*;

     

      private var ob:Array=new Array();

      public var mysqlConnection:SQLConnection;

      public var _createProdct:SQLStatement;

      public var _insertProduct:SQLStatement;

      public var _selectProduct:SQLStatement;

 

      private const _counterProduct:int = 1;

      private var databaseFile:File =

      File.applicationStorageDirectory.resolvePath("data.db");

      private const CREATE_PRODUCT_TABLE:String =

      "CREATE TABLE product (id INTEGER PRIMARY KEY,name TEXT," +

      "department TEXT, title TEXT, description TEXT);"

     

      private var _id:int;

      private var _name:String;

      private var _department:String;

      private var _title:String;

      private var _description:String;

     

      private var INSERT_PRODUCT:String;

      private const SELECT_PRODUCT:String = "SELECT * FROM product";

 

      public function createDatabase(databaseFile:File, productCount:int):void

      {

            if ((databaseFile != null) && (databaseFile.exists))

            {

                  databaseFile.deleteFile();

                  dg1.dataProvider=null;

                  Alert.show("Database Created Successfully.");

            }

     

            if (productCount < 1)

            {

                  productCount = 1;

            }

     

            mysqlConnection = new SQLConnection();

            mysqlConnection.open(databaseFile, SQLMode.CREATE);

            mysqlConnection.close();

            schemaGeneration();

      }

 

      public function deleteDatabase():void

      {

            if ((databaseFile != null) && (databaseFile.exists))

            {

                  databaseFile.deleteFile();

                  dg1.dataProvider=null;

                  Alert.show("Database Deleted Successfully.");

            }

            else

            {

                  Alert.show("There is no database to Delete.");

            }

      }

 

      private function schemaGeneration():void

      {

            var sqlStatement:SQLStatement = new SQLStatement();

            mysqlConnection=new SQLConnection();

            sqlStatement.sqlConnection = mysqlConnection;

            mysqlConnection.open(databaseFile, SQLMode.CREATE);

            sqlStatement.text = CREATE_PRODUCT_TABLE;

            sqlStatement.execute();

            mysqlConnection.close();

      }

 

      private function createInsertStatements():void

      {

            if((txt1.text !="")&&(txt2.text !="")&&(txt3.text !="")

            &&(txt4.text !=""))

            {

                  _id=0;

                  _name=txt1.text;

                  _department=txt2.text;

                  _title=txt3.text;

                  _description=txt4.text;

                 

                  if((databaseFile != null) && (databaseFile.exists))

                  {

                        INSERT_PRODUCT="INSERT INTO product (id, name, department, title, description)" +

                        " VALUES ("+"((SELECT max(id) FROM product)+1)"+",'"+_name+"','"+_department+

                        "','"+_title+"','"+_description+"');";

                        _insertProduct =new SQLStatement();

                        mysqlConnection=new SQLConnection();

                        _insertProduct.sqlConnection= mysqlConnection;

                        mysqlConnection.open(databaseFile, SQLMode.CREATE);

                        _insertProduct.text = INSERT_PRODUCT;

                        _insertProduct.execute();

                        mysqlConnection.close();

                        createSelectStatements();

                        clearAll();

                  }

                  else

                  {

                        Alert.show("There is no database so please create it First.");

                  }

            }

            else

            {    

                        Alert.show("Please enter the proper values For all the relative fields.");

            }

      }

 

      private function createSelectStatements():void

      {

                  _selectProduct =new SQLStatement();

                  mysqlConnection=new SQLConnection();

                  _selectProduct.sqlConnection = mysqlConnection;

                  mysqlConnection.open(databaseFile,SQLMode.READ);

                  _selectProduct.text = SELECT_PRODUCT;

                  _selectProduct.execute();

                  ob=_selectProduct.getResult().data;

                  mysqlConnection.close();

                  dg1.dataProvider=ob;

      }

 

      private function clearAll():void

      {

                  txt1.text="";

                  txt2.text="";

                  txt3.text="";

                  txt4.text="";

      }

]]>

 

</mx:Script>

 

<mx:VBox width=”100%” height=”100%” horizontalAlign=”center>

     

      <mx:HBox width=”80%” height=”30” horizontalAlign=”center>

     

            <mx:Label width=”120” textAlign=”right” text=”Name” color=”#ff0000/>

           

            <mx:TextInput id=”txt1” width=”120” height=”35/>

 

      </mx:HBox>

 

      <mx:HBox width=”80%” height=”30” horizontalAlign=”center>

     

            <mx:Label width=”120” textAlign=”right” text=”Department” color=”#ff0000/>

           

            <mx:TextInput id=”txt2” width=”120” height=”35/>

     

      </mx:HBox>

 

      <mx:HBox width=”80%” height=”30” horizontalAlign=”center>

     

            <mx:Label width=”120” textAlign=”right” text=”Title” color=”#ff0000/>

           

            <mx:TextInput id=”txt3” width=”120” height=”35/>

     

      </mx:HBox>

 

      <mx:HBox width=”80%” height=”30” horizontalAlign=”center>

     

            <mx:Label width=”120” textAlign=”right” text=”Description” color=”#ff0000/>

           

            <mx:TextInput id=”txt4” width=”120” height=”35/>

     

      </mx:HBox>

     

      <mx:HBox width=”80%” height=”100%” horizontalAlign=”center>

     

            <mx:DataGrid id=”dg1” width=”100%” height=”100%>

           

                  <mx:columns>

           

                        <mx:DataGridColumn id=”idCol” width=”50” dataField=”id” headerText=”Id” textAlign=”center/>

                       

                        <mx:DataGridColumn id=”nameCol” width=”100” dataField=”name

                              headerText=”Name” textAlign=”center/>

                       

                        <mx:DataGridColumn id=”departmentCol” width=”100” dataField=”department

                              headerText=”Department” textAlign=”center/>

                       

                        <mx:DataGridColumn id=”titleCol” width=”100” dataField=”title

                              headerText=”Title” textAlign=”center/>

                       

                        <mx:DataGridColumn id=”descriptionCol” width=”200” dataField=”description

                              headerText=”Description” textAlign=”center/>

           

                  </mx:columns>

           

            </mx:DataGrid>

     

      </mx:HBox>

     

      <mx:HBox width=”80%” height=”50” horizontalAlign=”center>

     

            <mx:Button id=”btnCreateDataBase” label=”Create DataBase” width=”130

                  click=”createDatabase(databaseFile,_counterProduct)”/>

           

            <mx:Button id=”btnInsertIntoDataBase” label=”Insert into DataBase” width=”150

                  click=”createInsertStatements()”/>

            <mx:Button id=”btnDeleteDataBase” label=”Delete DataBase” width=”130

                  click=”deleteDatabase()”/>

      </mx:HBox> 

</mx:VBox>

 </mx:WindowedApplication>

  

********************************************************** 

Hope you will enjoy this………………………………….. 

 

Posted in AIR, SQLite | 18 Comments »

 
Follow

Get every new post delivered to your Inbox.