Air 2.0 Accelerometer component for MacBooks

21 12 2009

Ever wanted to build super cool Games/Applications/Demos on your MacBook using Accelerometer ?

Yes, it is now possible to build all these cool stuff with Air 2.0 & MacBook.

MacBooks have a device called SMS ( Sudden Motion Sensor ) which can act as our Accelerometer. And using Air 2.0’s NativeProcess, we can invoke a native program to give us the Accelerometer data. Here is how the flow goes:

Accelerometer Flow Chart

I got a simple C-Program called “motion” (bundled in the below package) which can give me X,Y & Z co-ordinates of Accelerometer & print on the console. I execute the process using NativeProcess API & capture the console output.

I made a wrapper class called “MBAcceleromoter” to make this entire process easier.

Click here to download the source & demo. ( Air 2.0 SDK required )

Click here to download Demo alone. ( Air 2.0 runtime required )

This package contains:

1. “motion” program to capture Accelerometer data

2. “MBAccelerometer” class to invoke & “motion” program & returned structured output through event dispatch mechanism.

3. Sample application (Accelerometer.mxml) built using APE

What are you waiting for ? Go ahead & create some amazing stuff.

Here is what I have built in this demo:

Demo – Base position

Demo – Tilted Left

Demo – Tilted Right





iCheckBox – iPhone style Switch component for Flex

13 11 2009

iPhone has revolutionized the way world looks at Smart Phones. Apart from that, it had also set a new standard for Usability on phones & softwares in general.

I’m a huge fan of iPhone and I truly believe in it’s usability. Taking inspiration from it, I’m planning to port some of the iPhone components on to Flex and make it available for FREE.

Here is the first component in this series called iCheckBox. Its an equivalent to “Switch” component iPhone with more flexibility for controlling Labels, Width & Animation.

You can download the component,sample and source from here

Let me know how you like it or request any other interesting components that you want.

iCheckBox Component Preview





Mac Dashboard Style Calendar control in Flex

20 11 2008

Hello People,  Welcome back.

Its good to start blogging again after many days. I was very busy working on the next version of Flex i.e. Gumbo. I’m kinda free now after releasing the MAX Preview release of Gumbo. So, here I’m starting to share interesting stuff again.

Demos, Tutorials, Videos, Interesting applications and lots of other cool stuff to show you all. So, stay tuned to this blog to see all these

And, Thanks a ton for your all your comments and feedback on my earlier post on “Refreshingly new Flex Calendar controls” that really encouraged me to add one more to the list i.e MAC Dashboard style calendar along with source.

MAC Style Flex Calendar

Click here to download Component / Source






Refreshingly new Flex Calendar controls

1 07 2008

Flex is a very flexible language and I’m here to prove it again.

Today, I’m posting these two new cute flex calendar controls which uses inbuilt “CalendarLayout” class for functionality and has a completely new layout and interface defined in MXML.

I’m open sourcing these components and you are allowed to edit / use them in your projects with no restrictions.

So, go a head, have fun with these components and unleash your creativity bring out more cooler calendars.

Refreshing Flex Calendar Controls

Click here to Download Component / Source

Dear Readers, Please feel free to send me your Feedback / New Component Requests through comments or email.





CricketCentre – Cricket on your desktop

9 06 2008

Although Cricket is played by a few countries in the world, it is a religion in the Indian sub-continent and followed by millions in India alone.

Thanks to Twenty20 cricket & IPL tournament, the craze has increased lot more in the recent days and added lot more glamour to the game.

Even though we are Web 2.0 world, people watching cricket match through internet portals miss the excitement of game due to plain vanilla interface.

However this can be changed using RIA technologies and many aspects of watching a match live such as chatting with friends, participating in contests, enjoying charts and graphics can all be brought to user following through internet as well.

So, CricketNirvana.com brings you “CricketCentre”, the next generation of Cricketing experience to your desktop through Adobe AIR. This is a Rich Internet Application developed using Adobe Flex and runs on your desktop using Adobe AIR.

Home Page –http://www.cricketnirvana.com/CricketCentreWeb/CricketCentre.html

Feature Demo – http://www.cricketnirvana.com/CricketCentreWeb/FeatureDemo.html

                                    CricketCentre Screenshot

 Features

1) Realtime ball-by-ball score updates

2) Full & Mini-Scorecards

3) System tray & Pop-up notifications

4) Live Analytics & Statistics

5) Player profiles

6) Express Emotions

7) Gossip with friends

8 ) Watch Videos, News and lot more…

So, go a head and experience it…





Solution for HTML pop-up problem in AIR

24 04 2008

From the past few days, I’m seeing a problem with AIR HTML Component that is being reported by many users in many forums. So, i thought of giving a small solution which will help developers to overcome this problem.

Problem

AIR HTML Component fails to open new HTML pop-up window when the “target” of the link is set to “_blank” or “_new”.

Solution

The solution is very straight and simple.

Step 1 – Get all the available links of the page after it is completely loaded and add “onClick” event listener to all required links.

Step 2 – Get the Link’s URL in “onClick” event handler and open a new browser window using “navigateToURL()” or implement a custom window in AIR to handle this.

Code


<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:HTML id="htmlComp" width="100%" height="100%" location="http://www.rediff.com" complete="addEventListenersToLinks(event)"  />
 
 <mx:Script>
  <![CDATA[
   
   private function addEventListenersToLinks(e:Event):void
   {
    var dom:Object = e.currentTarget.domWindow.document;
    var links:Object = dom.getElementsByTagName("a");
    
    for(var i:Number = 0; i < links.length; i++)
    {
     if(links[i].target.toLowerCase() == "_blank" || links[i].target.toLowerCase() == "_new")
      links[i].onclick = linkClickHandler;
    }
   }
   
   private function linkClickHandler(o:Object):void
   {
    navigateToURL(new URLRequest(o.currentTarget.href),"blank");
   }
  ]]>
 </mx:Script>
</mx:WindowedApplication>