Tag Archive | "Flex"

SingleTon Pattern in Flex

November 4, 2008 2 comments

What is singleton pattern?

The singleton pattern is a design pattern that is used to restrict instantiation of a class to one object. If you create the class as a singleton then no way to create more than one instance. But, you can get that single instance in any number of classes. So all the classes will share the same properties and behaviours of that singleton object.

How to implement the singleton pattern?

Implementation of a singleton pattern must satisfy the single instance and global access principles. It requires a mechanism to access the singleton class member without creating a class object and a mechanism to persist the value of class members among class objects. The singleton pattern is implemented by creating a class with a method that creates a new instance of the class if one does not exist. If an instance already exists, it simply returns a reference to that object. To make sure that the object cannot be instantiated any other way, the constructor is made protected (not private, because reuse and unit test could need to access the constructor). Note the distinction between a simple static instance of a class and a singleton: although a…

Modular Applications

November 4, 2008 No comments yet

Modular applications

Sometimes our flex application’s size becomes very large. Due to this, we are facing many problems such as bandwidth, network traffic and it will take more time to load. We have many ways to solve this problem such as

1. Do not embed the assets into the project.
2. Modules.

About Modules

Modules are the swf files which can be loaded and unloaded dynamically by an application. The user cannot run the modules independently in the browser or the flash player. But the user can share the modules in any number of applications.

Benifits of Modules

  • Smaller initial download size of the SWF file.
  • Shorter load time due to smaller SWF file size.
  • Better encapsulation of related aspects of an application. For example, a “reporting” feature can be separated into a module that you can then work on independently.
  • Any number of applications can share the modules.

Creating the Modules

To create the modules we should create seperate mxml or actionscript class and an application that uses the modules. We can create the modules in two ways, one is by using the mxml and by using the actionscript class.

Creating the modules by using the

RIA and Flex

October 27, 2008 No comments yet

RIA

  • A rich Internet application (RIA) is a Web application designed to deliver the same features and functions normally associated with deskop applications.
  • RIAs typically form a stateful client application with a separate services layer on the backend.
  • Run in a web browser, or do not require software installation
  • Run locally in a secure environment called a sandbox
  • Installation footprint is smaller — overhead for updating and distributing the application is trivial, or significantly reduced compared to a desktop or OS native application
  • Updates/upgrades to new versions can be automatic or transparent to the end user
  • Users can use the application from any computer with an internet connection
  • Many tools exist to allow off-line use of applications, such as Adobe AIR, Google Gears, Curl, and other technologies
  • Most RIA techologies allow the user experience to be consistent, regardless of what operating system the client uses.
  • Web-based applications are generally less prone to viral infection than running an actual executable

Flex

Flex Builder IDE