Friday, May 16, 2008

Custom Event Creation and Data Passing

Passing Data With Custom Event


As being an event driven language Action Script provides the mechanism of sending any kind of object with
the event.The concept is more important when we are supposing to get value of any varialbe of mxml into
any another mxml which is far enough in the structure(Folder Structure)of our Application. It is very simple
to create any custom event for the occurence of any particular event.Within the same parent folder in which
your mxml containing the variable create a folder (let suppose with name ‘event’).In mxml let's suppose
variable of arrayCollecton ‘myCollection’ is defined and it is already assigned some data.
Now we will create a custom event ‘CustomEvent’ in the folder where your mxml(which is having that arrayCollection)is present.

Just create one action Script class file Copy and Paste the code below.
——————————————————————————————–
package myPro.events
{
import flash.events.Event;

public class CustomEvent extends Event
{

public var mybool:Boolean=true;
public var myCollection:ArrayCollection;

public function PropertyThumbEvent (type:String,myCollection,mybool:Boolean=true):void
{
super(type);
this.myArrayCollection = myArrayCollection;
this.b=b ;
}

override public function clone():Event
{
return new CustomEvent(type,myCollection,mybool);
}

}
}
——————————————————————————————–

Now at this mxml where ‘myCollection’ is present First add Metadata as below :-
——————————————————————————————–

[Event(name="myCustomEvent",type="myPro.events.myCustomEvent")]

——————————————————————————————–

Again from the same mxml just dispatch one event i.e. as:-

——————————————————————————————–
dispatchEvent(new CustomEvent(”myCustomEvent”,myCollection,true));

——————————————————————————————–
we can use it as follows:-

trace(event.myCollection)

Creating FullScreen Flex/AIR/Flash Applications

Going Fullscreen in Actionscript

The main stage for the AIR application has a displayState property. The framework also contains a class, StageDisplayState, that defines three constants for the three different display states. By using these classes you can put your AIR application into any of the three display states .

PLAIN TEXTActionscript:
// Enter Fullscreen Interactive State
stage.displayState = StageDisplayState.FULL_SCREEN_INTERACTIVE;
or
// Enter Standard Fullscreen State
stage.displayState = StageDisplayState.FULL_SCREEN;
or
// Enter Normal State
stage.displayState = StageDisplayState.NORMAL;

we can use these as follows :-








Going Fullscreen through JavaScript

The logic works exactly the same in JavaScript as it does in Actionscript, but the classpaths are different. You can see the examples below in Code Example 2.

PLAIN TEXTJavaScript:
// Enter Fullscreen Interactive State
window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN_INTERACTIVE;
or
// Enter Standard Fullscreen State
window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.FULL_SCREEN;
or
// Enter Normal State
window.nativeWindow.stage.displayState = runtime.flash.display.StageDisplayState.NORMAL;


Cheers

Varun Rathore

Thursday, May 15, 2008

Flex 4 (Gumbo)

Flex 4, codenamed Gumbo, is now beginning active development. The product plan is not yet complete, but a few themes are under consideration:

Design in Mind: provide a framework meant for continuous collaboration between designer and developer. Probably involves an additional component model that integrates with the existing Halo components.
Accelerated Development: take application development from concept to reality quickly. Features could include application templates, architectural framework integration, binding improvements.
Horizontal Platform Improvements: features that benefit all application and user types. Features could include compiler performance, language enhancements, BiDi components, enhanced text.
Broadening Horizons: expand the range of applications and use-cases that can leverage Flex. Features could include finding a way to make the framework lighter, supporting more deployment runtimes, runtime MXML.

Download Flex 4 build

Cheers

Varun Rathore

Flex Development Frameworks

1. Puremvc Framework

PureMVC is a lightweight framework for creating applications based upon the classic Model-View-Controller design meta-pattern.

2. Cairngorm Framework
Cairngorm Framework is the most widely accepeted framework with Flex development.

3. Prana Framework
Prana Framework is runtime control framework and made on the basis of spring framework.

4. Foundry
Foundry ( sbasfoundry ) is an ActionScript 3 / Java framework designed for Flex 2 applications development.

5. Guasax Flex Framework
Guasax is an ease of use programming framework to provide ordered and scalable Flex applications.
Life cycle of guasax framework is based in the MVC pattern to take on our program actions .

Wednesday, May 14, 2008

AIR Aplication Work Offline With Sqllite

We can make the AIR application work offline and synch with the database.

We can use sqllite databse for the offline display of data.
sqllite is just like mysql but it would create a *.db file in ur application folder
from where we can access the data.

A sample code for creating and executing the sqllite queries.

on creation complete we create a database contacts.

private function creationComplete():void
{
connection = new SQLConnection();
connection.open(File.applicationDirectory.resolvePath('contacts.db'));


var statement = new SQLStatement();
statement.text="CREATE TABLE IF NOT EXISTS contacts (ID INTEGER PRIMARY KEY AUTOINCREMENT, action TEXT, inputXML TEXT, outputXML TEXT)" ;
statement.sqlConnection=connection;
statement.execute();

var statement = new SQLStatement();
statement.text="CREATE TABLE IF NOT EXISTS offlineRequest (ID INTEGER PRIMARY KEY AUTOINCREMENT, action TEXT, inputXML TEXT)" ;
statement.sqlConnection=connection;
statement.execute();

}


This is very fast and effective too.

Cheers

Varun Rathore

About Me