Schemaphic Systems Blog

Sharing experiences in Flash, Flex and AIR

Archive for the ‘General’ Category

A Story of an Office-going Ant

with 5 comments

Once upon a time Mr. Ant used to work in an office. Every day, as soon as Ant reached the office, he used to get engaged with work without wasting time. He enjoyed doing so and remained cheerful as always and happy. This in turn lead to good production level.

The CEO, Mr. Lion was surprised to see the dedication of Ant and felt very happy within him. One day he thought, if Mr. Ant by himself can do such good work, he will be excelling more in performance under proper supervision. So the boss appointed Mr. Beetle as supervisor. Beetle was experienced and famous for supervising and had the capability of writing good reports.

Happy with the new opportunity, Beetle immediately introduced the time-sheet and attendance process which was lacking till then. With the increasing number of thought plans, Beetle himself unable to handle, appointed Mr. Spider as his personal secretary, whose work is to take notes from Beetle and organize them in good visual format for reports. Spider was also responsible for managing phone calls for Beetle.

Seeing the Reports, Lion appreciated much and asked Beetle to provide graphical reports on production and trend analysis, which Lion can display in the next Board meeting. Based on the new requirements, Beetle processed an order for purchasing a computer and a laser printer, and appointed Mr. Fly in charge of the IT department.

Meanwhile, Ant, who used to do a lot of work delightfully earlier, now had to spend more time in meetings and paper works. In turn Ant started losing the enthusiasm for work and the cheerfulness he had started to diminish slowly.

Lion looking into the work pressure of Beetle, thought that it would be wise to have a manager to control the whole department where Mr. Ant worked and appointed Mr. Cockroach. Cockroach in his new office was surprised to see the uncomfortable infrastructure in the department and hence ordered purchasing of ergonomic chair for himself and a good carpet for his cabin.

Along with that Cockroach also got his PA from the previous company to his new one and gave emphasis on Budget Control and Strategic Optimization Plan.

Surprisingly the Department in which the Ant worked, no one seemed to enjoy work anymore and where no more cheerful. At this juncture, Cockroach explained to Lion that a Climatic Study has become necessary for improving production.

Based on the analysis Lion found that the production level has gone down in the Ant’s department by considerable amount. So Lion hired a part-time consultant Mr. Owl to provide a solution to the problem.

Mr. Owl is a leading consultant in the world and is famous for providing solutions for increasing production.

Owl took three months to analyze and finally prepared a report of multiple pages broken up into modular sections. In short the analysis stated that the department was over-staffed.

Based on the report, Lion along with Cockroach call on a meeting and took an immediate decision to sack Mr. Ant due to lack in motivation and negative attitude in work.

Written by Deepanjan Das

February 1, 2012 at 1:38 PM

Posted in General

Tagged with

Global TImer in ActionScript

leave a comment »

With my experience with RIA using actionscript, I have come most applications where multiple timers are required.
As the application grows complex, the more and more timers added does slow up the application performance to lot.

That is where I thought of developing a utility class called GlobalTimer. It is a singleton class and runs only a single timer. So where ever in your application a timer is necessary, just add a timer name to this global timer with other parameters and you are done without hitting the application performance.

This class is a pure actionscript class and hence can be used both for flash, flex and AIR projects.

GlobalTimer.as

package com.te.utilities
{
import flash.events.EventDispatcher;
import flash.events.TimerEvent;
import flash.utils.Dictionary;
import flash.utils.Timer;

public class GlobalTimer extends EventDispatcher
{
public static const EQUALS : String = "equals";
public static const DIFFERENCE_FROM_CURRENT_TIME : String = "differs";
public static const CALL_IN_INTERVALS : String = "intervals";

public static var TIME_INTERVAL : int = 100;
public static var instance : GlobalTimer;

private var timer:Timer;
private var currentDate:Date;
private var currentTime:int;//in milliseconds
private var _running:Boolean = false;

private var timersForCheck:Dictionary;

public function GlobalTimer( enf:SingletonEnforcer )
{
timersForCheck = new Dictionary();

super();
}

public static function getInstance() : GlobalTimer
{
if( instance == null ) instance = new GlobalTimer( new SingletonEnforcer() );
return instance;
}

public function start() : void
{
if( _running )    return;

timer = new Timer( TIME_INTERVAL );
timer.addEventListener(TimerEvent.TIMER, onTimerHandler, false, 0, true );
timer.start();

_running = true;
}

private function onTimerHandler( event:TimerEvent ) : void
{
currentDate = new Date();
currentTime = ( currentDate.getHours() * 60 * 60 ) + ( currentDate.getMinutes() * 60 ) + ( currentDate.getSeconds() );

for each( var prop:* in timersForCheck ){
if( prop != null ){
switch( prop[2] ){
case EQUALS:
if( currentTime == ( prop[0] + prop[1] ) ){
//AUTO UPDATE CHECK
prop[3][ String( prop[4] ) ]();
}
break;

case DIFFERENCE_FROM_CURRENT_TIME:
//IDLE TIME CHECK
if( prop[5] != null ){
prop[3][ String( prop[5] ) ]();
}
if( ( currentTime - prop[0] ) == prop[1] && prop[4] != null ){
prop[3][ String( prop[4] ) ]();
}
break;

default:
//CALL_IN_INTERVALS:
if( ( timer.currentCount - prop[0] ) == prop[1] && prop[5] != null ){
prop[0] = timer.currentCount;
prop[3][ String( prop[5] ) ]();
}
break;
}
}
}
}

public function addTimer( name:String, time:Number, check:String, object:*, functionOnComplete:String=null, functionOnTimer:String=null ) : void
{
//timersForCheck[name] = [   0,      1,    2,     3,            4,                 5        ];
timersForCheck[name] = [ timer.currentCount, time, check, object, functionOnComplete, functionOnTimer ];
}

public function removeTimer( name:String ) : void
{
timersForCheck[name] = null;
}

public function isTimerRunning( name:String ) : Boolean
{
var prop:* = timersForCheck[ name ];
if( prop == null ){
return false;
}
return true;
}

public function getTimerData( name:String ) : Object
{
var prop:* = timersForCheck[ name ];
if( prop == null ){
return null;
}
var data:Object = {};
data.currentTime = ( currentTime - prop[0] );
data.remainingTime = ( prop[1] - data.currentTime );
return data;
}

public function stop() : void
{
if( timer != null ){
timer.stop();
timer.reset();
timer.removeEventListener( TimerEvent.TIMER, onTimerHandler, false );
timer = null;

_running = false;

for each( var prop:* in timersForCheck ){
if( prop != null ){
prop = null;
}
}
timersForCheck = null;
timersForCheck = new Dictionary();
}
}

public function get running() : Boolean
{
return _running;
}

protected function reset():void
{
stop();
}
}
}
internal class SingletonEnforcer{}

In the application use the following code:

//Code to be used in your application
private var globalTimer:GlobalTimer;

globalTimer = GlobalTimer.getInstance();
if( !globalTimer.running ){
globalTimer.start();//starts timer
}

//checks if the timer is already running
if ( !globalTimer.isTimerRunning( "game_timer" ) ) {
globalTimer.addTimer( "game_timer", _asuraThrowWeaponInterval, GlobalTimer.CALL_IN_INTERVALS, this, null, "onIntervalEventHandler" );
}

globalTimer.removeTimer( "game_timer" );//removes/clears the particular timer
globalTimer.stop();//stops all the timers

Written by Deepanjan Das

November 22, 2011 at 1:22 PM

2010 in review

leave a comment »

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

This blog was viewed about 5,200 times in 2010.

In 2010, there were 43 new posts!

The busiest day of the year was September 23rd with 94 views. The most popular post that day was Augmented Reality using FLARToolkit – restrict unnecessary model jumping.

Where did they come from?

The top referring sites in 2010 were words.transmote.com, forums.adobe.com, experts-exchange.com, blog.papervision3d.org, and slashingtongue.com.

Some visitors came searching, mostly for flartoolkit+problema camara, flex datechooser skin, flex datechooser, and as2 dispatchevent.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

Augmented Reality using FLARToolkit – restrict unnecessary model jumping July 2010
5 comments

2

Skinning DateChooser in Flex June 2010
2 comments

3

Tips & Tricks for improving AS3.0 performance May 2010

4

Truncate text in TextArea/TextField June 2010
1 comment

5

Quick customize FLVPlayback captioning July 2010
2 comments

Written by Deepanjan Das

March 9, 2011 at 8:32 AM

Posted in General

Flash to HTML5

leave a comment »

Adobe’s newly released “Wallaby” application that aims to expand support for Apple’s line of iOS devices, including the iPhone and iPad, by converting Flash files into HTML5.

Read more of it here.

Written by Deepanjan Das

March 9, 2011 at 8:26 AM

Posted in Flash, General, HTML5

Tagged with

Happy New Year 2011

leave a comment »

Happy New Year 2011

Happy New Year 2011 (source: http://coolvibe.com/2010/mommy)

Written by Deepanjan Das

December 31, 2010 at 1:59 PM

Posted in General

Tagged with ,

Adobe MAX Conference – A short glimpse

leave a comment »

Some points covered @ Adobe MAX:

– Hardware accelerated 3D
– Hardware accelerated Video
– The Flash platform included more devices, including TVs and set-top boxes

A complete checkout can be done here.

Written by Deepanjan Das

October 26, 2010 at 8:11 AM

Posted in General

Tagged with

Event held by Forum Nokia Team at The Park, Kolkata

with 2 comments

Last Saturday, 2nd October, 2010, I was invited to an event held by Forum Nokia Team at The Park, Kolkata.

Forum Nokia Team was to share the latest updates on Nokia services to explore business partnership opportunities and an exclusive meeting with Forum Nokia team. That followed with an exclusive dinner event.
 
The developers attending this event will be given an exclusive Launchpad membership worth 300 Euros.

I consider myself lucky to get invited and participate in the event.

The event was held by Mr. Sunil Rao, Head – Forum Nokia India. It was apleasure to meet him and get a glimpse of some of the latest Nokia sets coming to market.

He discussed on various opportunities in developing Nokia based apps. Thanks Sunil for a good presentation.

I as a FlashLite Developer for Mobile Devices, did not get much inputs on new and smarter ways of developing apps/games/utilities based on nokia device specific APIs. But it was good to learn that all latest Nokia devices are getting flash lite player ported into them.

The presentation seemd to be only focused for business opportunities but not for developers where I could get some light on any new device APIs provided by Forum Nokia .

Hope to have one event in Kolkata for only mobile developers using Nokia APIs for various technologies.

Written by Deepanjan Das

October 4, 2010 at 11:36 AM