Tuesday, December 23, 2008

Determining Inactivity in Flex (FlexEvent.IDLE)

A FlexEvent.IDLE event is dispatched every 100 milliseconds when there is no keyboard or mouse activity for 1 second.

In order to use the following event we need to import the following classes.
1. import mx.managers.SystemManager;
2. import mx.events.FlexEvent;
3. import mx.core.mx_internal;

You’ll need to tell your program that you want to use mx_internal as a namespace to access those properties within the SystemManager class. SytemManager has an “idleCounter” property which is super useful to access- but it is scoped to mx_internal and is not normally accessible. Trying to access it without these steps will throw an error:

1. use namespace mx_internal;

SystemManager is automatically instantiated as a part of every Flex app, so we do not need to do this manually. We will, however, need to add an event listener for FlexEvent.IDLE:

1. this.systemManager.addEventListener(FlexEvent.IDLE, userIdle);

Construct the callback method. One minutes is equal to 60000 milliseconds… divided by 100 ticks and the number we need to check against is 600. Of course, you’ll probably want something a little shorter in duration for testing:


private function userIdle(e:FlexEvent):void {
if(e.currentTarget.mx_internal::idleCounter == 600){
//do something!
}
}

Note that we prefix the idle Counter property with the mx_internal namespace.

That’s it! Now we have a sweet little activity monitor in our app. When activity is detected, idle Counter will automatically reset as well.

Sunday, December 7, 2008

Ribbit - Integrate Voice and Rich Communication


Ribbit - An open platform for multi-protocol communication for creating cool voiceware applications.
The Ribbit API's are simple and gives the opportunity to create new communication solutions for all sort of demands.
It enables developer to bring richness of voice calling and Web 2 Experience. You can add voice and Messaging service to your application without any traditional mobile phone intervention.
One thing that i found really good in Ribbit API is that Voice and Message can be delivered and received on multiple devices in multiple location across any sort of network.

About Me