Featured Post

Cairngorm PHP Login

This example explains how to communicate with PHP using the cairngorm framework:

Read More

AS3 Singleton class with parameterised constructor

Posted by ravi | Posted in Customization, flex | Posted on 23-02-2010

Tags: ,

0

As many of you already know, in AS3 there is no direct way to create singleton class i.e there is no keyword Singleton or any other equivalent keyword using which this can be accomplished. But there is a simple work around to create singleton class. The code below shows this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
public class Services extends EventDispatcher
{
public static function getInstance(url:String) : Services
{
if ( servicesLocator == null )
{
servicesLocator = new Services(url);
}

return servicesLocator;
}

public function Services(url:String)
{

if ( servicesLocator != null )
{
throw new Error( "Only one Services instance should be instantiated" );
}
ENDPOINT_URL=url
gateway=new HTTPService();
gateway.resultFormat="e4x";
gateway.url = ENDPOINT_URL;
gateway.method = "POST";
gateway.useProxy = false;
gateway.addEventListener(ResultEvent.RESULT, resultHandler);
gateway.addEventListener(FaultEvent.FAULT, faultHandler);
}
}

the way to create object now is like this:

1
public var servicesInstance:Services =Services.getInstance("serviceURL.php");

we’re defining here a static function called getInstance which calls the constructor only if servicesLocator object is null or not initialized already. A sinlgeton class is particularly of high use for HTTPService object as it allows single point of handling all the requests in this way.

Searching Flex XMLListCollection using IViewCursor

Posted by ravi | Posted in IViewCursor, XMLListCollection, flex | Posted on 01-07-2009

Tags: , , , , ,

0

This post explains how to search a XmlListColelction for multiple fields using IViewCursor’s findAny() method .

Recently in one of my projects, I’d to use the IViewCursor to search the XMLListCollection and faced some problems initially but implemented it successfully after doing some research. I’m posting the same example (-) the actual database contents…i’ll use sample XML files for the purpose of this example.

The scenario for which i’ve implemented this thing is as follows:

Adding custom path to viewSource option of your flex application

Posted by ravi | Posted in Application, Customization, flex | Posted on 23-06-2009

0

Ok. Today i was trying to export the release build of a simple example i’ve done with the View Source option enabled. But the problem is the source path can only be relative to bin-release which wont work with the perma link system that i’m using with my wordpress blog which creates virtual links.

At first i thought of giving a custom path value to the viewSourceURL property of the Application tag like this:

Tooltip custom Placement on Flex Listbox rollover

Posted by ravi | Posted in Listbox, flex, tooltip | Posted on 18-06-2009

Tags: , ,

0

The example below shows how to add a tooltip on roll over event of flex ListBox items. I don’t say that this is the perfect way to do this…but i’m happy as long as it serves me…

Cairngorm PHP Login

Posted by ravi | Posted in cairngorm, flex | Posted on 17-06-2009

Tags: , , ,

0

This example explains how to communicate with PHP using the cairngorm framework: