Showing posts with label Flex. Show all posts
Showing posts with label Flex. Show all posts

session in flex

Tuesday, May 17, 2011 Posted by Sanka Senevirathna 0 comments
As you know there is not variables like session in flex.But i have created a class call session that can perform the task of session in our day to day programming life.Class have two basic methods setAttribute and getAttribute.we can keep any type value as key and value.
What is inside happening? I used singleton design pattern,generic and dictionary for the work.
You can Use the following class as a session in flex.

[Bindable]
private var session:Session = Session.getInstance();

How to insert data to session
session.setAttribute('username','sanka')

How to retrive data from session
var userName:String=session.getAttribute('username');

download the class from here.
http://dl.dropbox.com/u/7375335/Session.as

I have create a link in forum for questions
http://forums.adobe.com/thread/799057?tstart=0
Labels:

Java Flex Spring JPA BlazeDS Integration

Saturday, May 14, 2011 Posted by Sanka Senevirathna 1 comments

This sample application was develop by me for ceylon electricity board(CEB).application alow user to

· Insert/enter data

· Retrive/view data

· Edit/upate data and

· upload bulk data such as excel sheet

· Reporting & graphs

· Loging system(spring security)

http://dl.dropbox.com/u/7375335/sample%20ceb/TestApplication.swf

Labels: , , , ,

How to create flex component and best practices

Saturday, October 30, 2010 Posted by Sanka Senevirathna 0 comments
Intercommunication with flex components


Application Flow

App.mxml à Component .mxml

Data passing

Component àCustomEvent Object à Application

Why we say loosly couple?

Component properties aren’t accessed directly by Application.Otherwose when component change some id property or something, we have to update all the refered applications.



app.mxml is the main application.GetKey.mxml is the component and GetKeyEvent.as is the custom event class that transfer the data.

There is a variable in GetKeyEvent.as and that is public as you can see.This is the one that access both GetKey.mxml component and app.mxml application.

[Bindable]

public var key:String=null;

GetKey.mxml push the data to key and app.mxml read the data from key in GetKeyEvent.as.

GetKey.mxml push the data to key

var getKeyEvent:GetKeyEvent= new GetKeyEvent("getKey",txtKey.text);

getKeyEvent.key=txtKey.text;

dispatchEvent(getKeyEvent);

app.mxml read the data from key in GetKeyEvent.as

var getKey:GetKey =new GetKey();

getKey.addEventListener("getKey",getkey1_getKeyHandler);

How to registering an event

As following we have to register an event in our component.getKey is the name of event that visible to main app.

[Event(name="getKey",type="events.GetKeyEvent")]

How to Access the component and it’s events from main app

You can download the sample project from here

http://dl.dropbox.com/u/7375335/components.fxp

Labels:

Spring BlazeDS Integration

Tuesday, June 1, 2010 Posted by Sanka Senevirathna 0 comments

Spring BlazeDS Integration






1. Configuring and Using the BlazeDS


MessageBroker with Spring



MessageBroker is the heart of the Spring BlazeDS Integration.
When HTTP messages come from Flex client will be routed through the
Spring DispatcherServlet to the Spring-managed MessageBroker.

There is no need to configure the BlazeDS MessageBrokerServlet when using the
Spring-managed MessageBroker.





2. Configuring the Spring DispatcherServlet


web.xml is the heart of the j2ee web project.So we have to configure it because
each an every request is map to web.xml.

The DispatcherServlet must be configured in web.xml to bootstrap a Spring
WebApplicationContext. For example:





Spring MVC Dispatcher Servlet
org.springframework.web.servlet.DispatcherServlet

contextConfigLocation
/WEB-INF/config/web-application-config.xml

1



3. Configuring the MessageBroker in Spring


A simplified Spring XML config namespace is provided for configuring the MessageBroker in
your WebApplicationContext. To use the namespace support you must add the schema location
in your Spring XML config files. A typical config will look something like the following:




...



Following XML config namespace tags makes the Spring BlazeDS Integration configuration tags available under the flex
namespace in your configuration files. The above setup will be assumed for the rest of the
configuration examples to follow. For the full detail of every attribute and tag available in the



config namespace, be sure to refer to the spring-flex-1.0.xsd as every element and attribute is
fully documented there. Using an XSD-aware XML editor such as the one in Eclipse should
bring up the documentation automatically as you type.

At a minimum, the MessageBrokerFactoryBean must be configured as a bean in your
Spring WebApplicationContext in order to bootstrap the MessageBroker, along with a
MessageBrokerHandlerAdapter and an appropriate HandlerMapping (usually a
SimpleUrlHandlerMapping) to route incoming requests to the Spring-managed
MessageBroker.

These beans will be registered automatically by using the provided message-broker tag in
your bean definition file. For example, in its simplest form:






This will set up the MessageBroker and necessary supporting infrastructure using sensible
defaults. The defaults can be overriden using the provided attributes of the message-broker
tag and its associated child elements. For example, the default location of the BlazeDS XML
configuration file (/WEB-INF/flex/services-config.xml) can be overridden using the
services-config-path attribute. The MessageBrokerFactoryBean uses Spring's
ResourceLoader abstraction, so that typical Spring resource paths may be used. For
example, to load the configuration from the application's classpath:



The equivalent MessageBrokerFactoryBean definition using vanilla Spring configuration
would be:








Note especially that with the message-broker tag, it is not necessary to assign a custom id to
the MessageBroker, and it is in fact discouraged so that you won't have to continually reference
it later. The only reason you would ever need to provide a custom id is if you were bootstrapping
more than one MessageBroker in the same WebApplicationContext.
Labels: , , ,

How to navigating through the Data using Flex form

Sunday, May 30, 2010 Posted by Sanka Senevirathna 0 comments

How to navigating through the Data or ArrayCollection using Flex form





I know you guys have a problem of having navigating through tha data of ArrayCollection by using the Flex Form
Here is the solution for viewing data, or navigating data of Flec ArrayColletion that contain bean objects....



















selectedMember)
{
selectedMember = selectedMember + 1;
tiDebAddress1.text=lststatus.getItemAt(selectedMember).status;
cmdPrevious.enabled=true;
if(lststatus.length-1 == selectedMember)
{
cmdNext.enabled=false;
cmdPrevious.enabled=true;
}
else
cmdNext.enabled=true;
}
}

private function prevousItem():void
{
if(lststatus.length > 0 && selectedMember > 0)
{
selectedMember = selectedMember - 1;
tiDebAddress1.text=lststatus.getItemAt(selectedMember).status;
if(selectedMember==0)
{
cmdPrevious.enabled=false;
cmdNext.enabled=true;
}
else
cmdPrevious.enabled=true;
}
}

]]>



Labels:

Flex : How to calculate Datagrid column total

Wednesday, May 12, 2010 Posted by Sanka Senevirathna 0 comments
How to calculate Datagrid column total
Manipulating flex datagrid colomns

Select a colomn name from comboBox and hit the button and enjoy...


Happy coding.....













you can download the code from here








































Labels:

Flex Dynamically popup searchable Datagrid

Tuesday, May 11, 2010 Posted by Sanka Senevirathna 0 comments
Flex Dynamically popup searchable Data-grid For Demo purpose I have create non DB version as following.Full code example is following... Check it and get idea...No need to describe this.









mainApp.mxml




























PopUpGrid.as


package com.dspl.component
{
import com.iwobanas.controls.MDataGrid;
import com.iwobanas.controls.dataGridClasses.MDataGridColumn;
import com.iwobanas.controls.dataGridClasses.filterEditors.SliderFilterEditor;
import com.iwobanas.controls.dataGridClasses.filterEditors.WildcardFilterEditor;
import com.iwobanas.core.ISearchable;
import flash.events.Event;
import flash.events.MouseEvent;
import mx.collections.ArrayCollection;
import mx.containers.HBox;
import mx.containers.TitleWindow;
import mx.controls.Alert;
import mx.controls.Button;
import mx.controls.Label;
import mx.controls.TextInput;
import mx.core.Application;
import mx.core.ClassFactory;
import mx.events.DataGridEvent;
import mx.events.DragEvent;
import mx.events.FlexEvent;
import mx.managers.DragManager;
import mx.managers.PopUpManager;

public class PopUpGrid
{

var mygrid:MDataGrid;
var tt:TitleWindow;
var txt:TextInput;
var columnName:String;
var txtSearch:TextInput;

[Bindable]
public var target:ISearchable;

public function PopUpGrid(listCollectionFCurrencies:ArrayCollection,txt:TextInput,app:Application,columnName:String,columnsNameList:Array,columnsFilterList:Array)
{
this.txt=txt;
this.columnName=columnName;
tt=new TitleWindow()
mygrid =new MDataGrid();
mygrid.dataProvider=listCollectionFCurrencies;
mygrid.columns =getDataGridColumns(columnsNameList,columnsFilterList);

mygrid.editable=true;
mygrid.dragEnabled=true;
mygrid.width=500;

/* //Following code is the call to component
var mySearch:SearchBox=new SearchBox();
mySearch.target=mygrid;
tt.addChild(mySearch); */

//Following code segment is for SearchBox facility
var hBoxSearch:HBox=new HBox();
target=mygrid;
var lblSearch:Label=new Label();
lblSearch.text="Search:"
txtSearch=new TextInput();
txtSearch.addEventListener(Event.CHANGE,function() {target.find(txtSearch.text);});
//txtSearch.addEventListener(Event.CHANGE,function() {mouseOverListener('Print This');});
txtSearch.setStyle('backgroundColor','{!target.searchString || target.found ? 0xffffff:0xff0000}');
txtSearch.addEventListener(FlexEvent.ENTER,function() {target.findNext();});
txtSearch.toolTip="Live search";

var previousButton:Button=new Button();
previousButton.enabled='{target.searchString != null}';
previousButton.label="<" previousButton.toolTip="Previous" previousButton.addEventListener(MouseEvent.CLICK,function() {target.findPrevious();}); var nextButton:Button=new Button(); nextButton.enabled='{target.searchString != null}'; nextButton.label=">"
nextButton.toolTip="Next"
nextButton.addEventListener(MouseEvent.CLICK,function() {target.findNext();});

hBoxSearch.addChild(lblSearch);
hBoxSearch.addChild(txtSearch);
hBoxSearch.addChild(previousButton);
hBoxSearch.addChild(nextButton);
tt.addChild(hBoxSearch);

//Above code segment is for SearchBox facility

tt.addChild(mygrid);
PopUpManager.addPopUp(tt, app, false);
PopUpManager.centerPopUp(tt);//this is only set location :center
mygrid.addEventListener(DataGridEvent.ITEM_EDIT_BEGINNING,clickRow);
this.txt.addEventListener(DragEvent.DRAG_ENTER,fndragEnterHandler);//grag and drop facility
this.txt.addEventListener(DragEvent.DRAG_OVER,fndragOverHandler);//grag and drop facility
this.txt.addEventListener(DragEvent.DRAG_DROP,fndragDropHandler);//grag and drop facility

}

private function getDataGridColumns(columnsNameList:Array,columnsFilterList:Array):Array {
var dataGridColumnList:Array =new Array();

for (var i:String in columnsNameList)
{

//Type of Filters : MultipleChoiceFilterEditor,SliderFilterEditor,WildcardFilterEditor,NumberRangeFilter,DateRangeFilter(new one)
var dgc:MDataGridColumn = new MDataGridColumn(columnsNameList[i]);
if("String"==columnsFilterList[i]){dgc.filterEditor=new ClassFactory(WildcardFilterEditor);}
else if("Integer"==columnsFilterList[i]){dgc.filterEditor=new ClassFactory(SliderFilterEditor); }
// else if("Date"==columnsFilterList[i]){dgc.filterEditor=new ClassFactory(DateRangeFilterEditor); }
dataGridColumnList.push(dgc);
}
return dataGridColumnList;
}

private function clickRow(event:DataGridEvent):void
{
try{
//this.txt.text=mygrid.selectedItem.curCode;//event.rowIndex.toString();
this.txt.text=mygrid.selectedItem[columnName];//event.rowIndex.toString();
PopUpManager.removePopUp(tt);
}
catch (e:Error) {
Alert.show( e.message);
}
}

private function fndragEnterHandler(event:DragEvent):void
{
if (event.dragSource.hasFormat("items"))
DragManager.acceptDragDrop(TextInput(event.currentTarget));
}

private function fndragOverHandler(event:DragEvent):void
{
if (event.dragSource.hasFormat("items"))
DragManager.showFeedback(DragManager.COPY);
}

private function fndragDropHandler(event:DragEvent):void
{
event.preventDefault();
var itemsArray:Array = event.dragSource.dataForFormat("items") as Array;
TextInput(event.currentTarget).text=itemsArray[0].(this.columnName);
}


}
}




This is non Database program MXML file




























This is non Database program .as file

package com.dspl.component
{
import com.iwobanas.controls.MDataGrid;
import com.iwobanas.controls.dataGridClasses.MDataGridColumn;
import com.iwobanas.controls.dataGridClasses.filterEditors.SliderFilterEditor;
import com.iwobanas.controls.dataGridClasses.filterEditors.WildcardFilterEditor;
import com.iwobanas.core.ISearchable;
import flash.events.Event;
import flash.events.MouseEvent;
import mx.collections.ArrayCollection;
import mx.containers.HBox;
import mx.containers.TitleWindow;
import mx.controls.Alert;
import mx.controls.Button;
import mx.controls.Label;
import mx.controls.TextInput;
import mx.core.Application;
import mx.core.ClassFactory;
import mx.events.DataGridEvent;
import mx.events.DragEvent;
import mx.events.FlexEvent;
import mx.managers.DragManager;
import mx.managers.PopUpManager;

public class PopUpGrid
{

var mygrid:MDataGrid;
var tt:TitleWindow;
var txt:TextInput;
var columnName:String;
var txtSearch:TextInput;

[Bindable]
public var target:ISearchable;

public function PopUpGrid(listCollectionFCurrencies:ArrayCollection,txt:TextInput,app:Application,columnName:String,columnsNameList:Array,columnsFilterList:Array)
{
this.txt=txt;
this.columnName=columnName;
tt=new TitleWindow()
mygrid =new MDataGrid();
mygrid.dataProvider=listCollectionFCurrencies;
mygrid.columns =getDataGridColumns(columnsNameList,columnsFilterList);

mygrid.editable=true;
mygrid.dragEnabled=true;
mygrid.width=400;

/* //Following code is the call to component
var mySearch:SearchBox=new SearchBox();
mySearch.target=mygrid;
tt.addChild(mySearch); */

//Following code segment is for SearchBox facility
var hBoxSearch:HBox=new HBox();
target=mygrid;
var lblSearch:Label=new Label();
lblSearch.text="Search:"
txtSearch=new TextInput();
txtSearch.addEventListener(Event.CHANGE,function() {target.find(txtSearch.text);});
//txtSearch.addEventListener(Event.CHANGE,function() {mouseOverListener('Print This');});
txtSearch.setStyle('backgroundColor','{!target.searchString || target.found ? 0xffffff:0xff0000}');
txtSearch.setStyle('border-color','{#EDF5FE}');
txtSearch.addEventListener(FlexEvent.ENTER,function() {target.findNext();});
txtSearch.toolTip="Live search";

var previousButton:Button=new Button();
previousButton.enabled='{target.searchString != null}';
previousButton.label="<" previousButton.toolTip="Previous" previousButton.addEventListener(MouseEvent.CLICK,function() {target.findPrevious();}); var nextButton:Button=new Button(); nextButton.enabled='{target.searchString != null}'; nextButton.label=">"
nextButton.toolTip="Next"
nextButton.addEventListener(MouseEvent.CLICK,function() {target.findNext();});

hBoxSearch.addChild(lblSearch);
hBoxSearch.addChild(txtSearch);
hBoxSearch.addChild(previousButton);
hBoxSearch.addChild(nextButton);
tt.addChild(hBoxSearch);

//Above code segment is for SearchBox facility

tt.addChild(mygrid);
PopUpManager.addPopUp(tt, app, false);
PopUpManager.centerPopUp(tt);//this is only set location :center
mygrid.addEventListener(DataGridEvent.ITEM_EDIT_BEGINNING,clickRow);
this.txt.addEventListener(DragEvent.DRAG_ENTER,fndragEnterHandler);//grag and drop facility
this.txt.addEventListener(DragEvent.DRAG_OVER,fndragOverHandler);//grag and drop facility
this.txt.addEventListener(DragEvent.DRAG_DROP,fndragDropHandler);//grag and drop facility

}

private function getDataGridColumns(columnsNameList:Array,columnsFilterList:Array):Array {
var dataGridColumnList:Array =new Array();

for (var i:String in columnsNameList)
{

//Type of Filters : MultipleChoiceFilterEditor,SliderFilterEditor,WildcardFilterEditor,NumberRangeFilter,DateRangeFilter(new one)
var dgc:MDataGridColumn = new MDataGridColumn(columnsNameList[i]);
if("String"==columnsFilterList[i]){dgc.filterEditor=new ClassFactory(WildcardFilterEditor);}
else if("Integer"==columnsFilterList[i]){dgc.filterEditor=new ClassFactory(SliderFilterEditor); }
// else if("Date"==columnsFilterList[i]){dgc.filterEditor=new ClassFactory(DateRangeFilterEditor); }
dataGridColumnList.push(dgc);
}
return dataGridColumnList;
}

private function clickRow(event:DataGridEvent):void
{
try{
//this.txt.text=mygrid.selectedItem.curCode;//event.rowIndex.toString();
this.txt.text=mygrid.selectedItem[columnName];//event.rowIndex.toString();
PopUpManager.removePopUp(tt);
}
catch (e:Error) {
Alert.show( e.message);
}
}

private function fndragEnterHandler(event:DragEvent):void
{
if (event.dragSource.hasFormat("items"))
DragManager.acceptDragDrop(TextInput(event.currentTarget));
}

private function fndragOverHandler(event:DragEvent):void
{
if (event.dragSource.hasFormat("items"))
DragManager.showFeedback(DragManager.COPY);
}

private function fndragDropHandler(event:DragEvent):void
{
event.preventDefault();
var itemsArray:Array = event.dragSource.dataForFormat("items") as Array;
TextInput(event.currentTarget).text=itemsArray[0].(this.columnName);
}


}
}
Labels:

EJB 3.0 to Servlet then Servlet to Flex

Tuesday, January 12, 2010 Posted by Sanka Senevirathna 0 comments

EJB 3.0 and Servlet client code with MySql and Glassfish server


If you have any problem contact me sankadil@gmail.com 0713331611 in srilanka
















package com.datamation.frontend.servlet;
import com.datamation.ejb.statless.EmployeDetails;
import com.datamation.ejb.statless.NewInterface;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Vector;
import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
*
* @author Sanka Dilmadu Senavirathna
*/
@WebServlet(name="EmpWorkHours", urlPatterns={"/EmpWorkHours"})
public class EmpWorkHours extends HttpServlet {
@EJB
private NewInterface empInstance;

protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
Vector empList=empInstance.getEmpWorkHoursInfo();
out.println(empList);
out.println("<?xml version=\"1.0\"?>\n");
out.println("<catalog>");
for (int i=0; i<empList.size();i++) {
out.println("<employe employeId=\"" + ((EmployeDetails)empList.get(i)).getEmp_id()+ "\">");
out.println("<name>" + ((EmployeDetails)empList.get(i)).getEmp_name() + "</name>");
out.println("<workhours>" + ((EmployeDetails)empList.get(i)).getEmp_work_hours()+ "</workhours>");
out.println("<month>" + ((EmployeDetails)empList.get(i)).getEmp_work_month()+ "</month>");
out.println("<avgworkhours>" + ((EmployeDetails)empList.get(i)).getEmp_workHoursAvg() + "</avgworkhours>");
out.println("</employe>");
}
out.println("</catalog>");
} finally {
out.close();
}
}

// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>

}





package com.datamation.ejb.statless;
import javax.ejb.Stateless;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Vector;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

@Stateless
public class Employe implements NewInterface {


private Connection CreateCon() {
Connection con = null;
try {
InitialContext ic = new InitialContext();
DataSource ds = (DataSource) ic.lookup("jdbc/mysqltest");
con = ds.getConnection();
System.out.println("Connection to tutorialApn Successfull");

} catch (NamingException e) {
e.printStackTrace();
System.out.println("Connection to tutorialApn UNSuccessfull");
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("Connection to tutorialApn UNSuccessfull");
}
return con;
}

private boolean CloseAll(Connection con, ResultSet rs, PreparedStatement st) {
boolean closed = true;
try {
st.close();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Connection not closed properly");
closed = false;
}
try {
rs.close();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Connection not closed properly");
closed = false;
}
try {
con.close();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Connection not closed properly");
closed = false;
}
return closed;
}

private boolean CloseAll(Connection con, PreparedStatement st) {
boolean closed = true;
try {
st.close();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("PreparedStatement not closed properly");
closed = false;
}

try {
con.close();
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Connection not closed properly");
closed = false;
}
return closed;
}

public int setEmpInfo(EmployeDetails employeInstance) {

Connection con = CreateCon();
PreparedStatement ps = null;
int rs = 0;
try {
ps = con.prepareStatement("INSERT INTO emp_information (emp_name,emp_address_town,emp_address_street,emp_address_no) VALUES (?,?,?,?)");
ps.setString(1, employeInstance.getEmp_name());
ps.setString(2, employeInstance.getEmp_address_town());
ps.setString(3, employeInstance.getEmp_address_street());
ps.setString(4, employeInstance.getEmp_address_no());
rs = ps.executeUpdate();

} catch (Exception ex) {
ex.printStackTrace();

} finally {
CloseAll(con,ps);
}

return rs;
}

public int setEditEmpInfo(EmployeDetails employeInstance) {

Connection con = CreateCon();
PreparedStatement ps = null;
int rs = 0;
try {
//UPDATE table_name SET column1=value, column2=value2 WHERE some_column=some_value
ps = con.prepareStatement("UPDATE emp_information SET emp_name=?,emp_address_town=?,emp_address_street=?,emp_address_no=? WHERE emp_id=?");
ps.setString(1, employeInstance.getEmp_name());
ps.setString(2, employeInstance.getEmp_address_town());
ps.setString(3, employeInstance.getEmp_address_street());
ps.setString(4, employeInstance.getEmp_address_no());
ps.setInt(5, employeInstance.getEmp_id());
rs = ps.executeUpdate();

} catch (Exception ex) {
ex.printStackTrace();

} finally {
CloseAll(con,ps);
}

return rs;
}

public Vector getEmpInfo(String key) {

Vector employeList = new Vector();
Connection con = CreateCon();
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = con.prepareStatement("SELECT emp_id,emp_name,emp_address_town,emp_address_street,emp_address_no FROM emp_information WHERE emp_name LIKE ?");
// ps.setString(1, key);
ps.setString(1, key + "%");
//ps = con.prepareStatement("SELECT emp_id,emp_name,emp_address_town,emp_address_street,emp_address_no FROM emp_information WHERE emp_name LIKE '" + key + "%'");
// ps.setString(0, key);
// WHERE emp_name LIKE '"+key+"%'
rs = ps.executeQuery();
while (rs.next()) {
EmployeDetails employeInstance = new EmployeDetails();
employeInstance.setEmp_id(rs.getInt("emp_id"));
employeInstance.setEmp_name(rs.getString("emp_name"));
employeInstance.setEmp_address_no(rs.getString("emp_address_no"));
employeInstance.setEmp_address_street(rs.getString("emp_address_street"));
employeInstance.setEmp_address_town(rs.getString("emp_address_town"));
employeList.add(employeInstance);
System.out.println("vector is : " + employeList);
System.out.println("vector size is : " + employeList.size());
}

} catch (Exception ex) {
ex.printStackTrace();
} finally {
CloseAll(con, rs, ps);
}

return employeList;
}



public Vector getEmpWorkHoursInfo() {

Vector employeList = new Vector();
Connection con = CreateCon();
PreparedStatement ps = null;
ResultSet rs = null;
try {
//SELECT * FROM `emp_workhours` WHERE 1
//SELECT emp_workhours.emp_id,MONTH , workhours, emp_information.emp_name, AVG( workhours ) AS workhoursAverage FROM emp_workhours, emp_information WHERE emp_information.emp_id = emp_workhours.emp_id
//,AVG(workhours) AS workhoursAverage
// (AVG(workhours) - workhours) AS workhoursAverage
ps = con.prepareStatement("SELECT emp_workhours.emp_id,month,workhours,emp_information.emp_name FROM emp_workhours, emp_information WHERE emp_information.emp_id=emp_workhours.emp_id");
// ps.setString(1, key);
// ps.setString(1, key + "%");
//ps = con.prepareStatement("SELECT emp_id,emp_name,emp_address_town,emp_address_street,emp_address_no FROM emp_information WHERE emp_name LIKE '" + key + "%'");
// ps.setString(0, key);
// WHERE emp_name LIKE '"+key+"%'
rs = ps.executeQuery();
while (rs.next()) {
EmployeDetails employeInstance = new EmployeDetails();
employeInstance.setEmp_id(rs.getInt("emp_id"));
employeInstance.setEmp_work_month(rs.getString("month"));
employeInstance.setEmp_work_hours(rs.getString("workhours"));
employeInstance.setEmp_name(rs.getString("emp_name"));
//employeInstance.setEmp_workHoursAvg(rs.getString("workhoursAverage"));
employeList.add(employeInstance);
System.out.println("vector is : " + employeList);
System.out.println("vector size is : " + employeList.size());
}

} catch (Exception ex) {
ex.printStackTrace();

} finally {
CloseAll(con, rs, ps);
}

return employeList;
}


public String getName() {
Connection conc = CreateCon();
PreparedStatement ps = null;
ResultSet rs = null;
String name = "";

try {
ps = conc.prepareStatement("select emp_id ,emp_name from emp_information ");
rs = ps.executeQuery();
while (rs.next()) {
name = rs.getString("emp_name");
}
} catch (Exception ex) {
ex.printStackTrace();
} finally {
CloseAll(conc, rs, ps);
}

return name;
}


}

package com.datamation.ejb.statless;

import java.util.Vector;

/**
*
* @author Administrator
*/
public interface NewInterface extends EmployeLocal, EmployeRemote {

Vector getEmpInfo(String key);
int setEmpInfo(EmployeDetails employeInstance) ;
String getName();
int setEditEmpInfo(EmployeDetails employeInstance);
Vector getEmpWorkHoursInfo();
}

package com.datamation.ejb.statless;

import java.util.Vector;
import javax.ejb.Remote;

/**
*
* @author Administrator
*/
@Remote
public interface EmployeRemote {
public String getName();
public Vector getEmpInfo(String key);
public int setEmpInfo(EmployeDetails employeInstance);
public int setEditEmpInfo(EmployeDetails employeInstance);
public Vector getEmpWorkHoursInfo();
}






package com.datamation.ejb.statless;
import java.io.Serializable;
public class EmployeDetails implements Serializable {

private int emp_id =0;
private String emp_name=null;
private String emp_address_town=null;
private String emp_address_street=null;
private String emp_address_no=null;
private String emp_work_hours=null;
private String emp_work_month=null;
private String emp_workHoursAvg=null;
/**
* @return the emp_id
*/
public int getEmp_id() {
return emp_id;
}

/**
* @param emp_id the emp_id to set
*/
public void setEmp_id(int emp_id) {
this.emp_id = emp_id;
}

/**
* @return the emp_name
*/
public String getEmp_name() {
return emp_name;
}

/**
* @param emp_name the emp_name to set
*/
public void setEmp_name(String emp_name) {
this.emp_name = emp_name;
}

/**
* @return the emp_address_town
*/
public String getEmp_address_town() {
return emp_address_town;
}

/**
* @param emp_address_town the emp_address_town to set
*/
public void setEmp_address_town(String emp_address_town) {
this.emp_address_town = emp_address_town;
}

/**
* @return the emp_address_street
*/
public String getEmp_address_street() {
return emp_address_street;
}

/**
* @param emp_address_street the emp_address_street to set
*/
public void setEmp_address_street(String emp_address_street) {
this.emp_address_street = emp_address_street;
}

/**
* @return the emp_address_no
*/
public String getEmp_address_no() {
return emp_address_no;
}

/**
* @param emp_address_no the emp_address_no to set
*/
public void setEmp_address_no(String emp_address_no) {
this.emp_address_no = emp_address_no;
}

/**
* @return the emp_work_hours
*/
public String getEmp_work_hours() {
return emp_work_hours;
}

/**
* @param emp_work_hours the emp_work_hours to set
*/
public void setEmp_work_hours(String emp_work_hours) {
this.emp_work_hours = emp_work_hours;
}

/**
* @return the emp_work_month
*/
public String getEmp_work_month() {
return emp_work_month;
}

/**
* @param emp_work_month the emp_work_month to set
*/
public void setEmp_work_month(String emp_work_month) {
this.emp_work_month = emp_work_month;
}

/**
* @return the emp_workHoursAvg
*/
public String getEmp_workHoursAvg() {
return emp_workHoursAvg;
}

/**
* @param emp_workHoursAvg the emp_workHoursAvg to set
*/
public void setEmp_workHoursAvg(String emp_workHoursAvg) {
this.emp_workHoursAvg = emp_workHoursAvg;
}

}


-- phpMyAdmin SQL Dump
-- version 3.0.1.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 13, 2010 at 05:28 AM
-- Server version: 5.1.30
-- PHP Version: 5.2.7

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `employe`
--

-- --------------------------------------------------------

--
-- Table structure for table `emp_information`
--

CREATE TABLE `emp_information` (
`emp_id` int(5) NOT NULL AUTO_INCREMENT,
`emp_name` varchar(50) NOT NULL,
`emp_address_town` varchar(50) NOT NULL,
`emp_address_street` varchar(50) NOT NULL,
`emp_address_no` varchar(10) NOT NULL DEFAULT '',
PRIMARY KEY (`emp_id`),
UNIQUE KEY `emp_name` (`emp_name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=35 ;

--
-- Dumping data for table `emp_information`
--

INSERT INTO `emp_information` (`emp_id`, `emp_name`, `emp_address_town`, `emp_address_street`, `emp_address_no`) VALUES
(1, 'sanka', 'a/pura', 'samagi mawatha', '1'),
(2, 'alex', 'newyork', 'maya mawatha', '2'),
(3, 'suresh', 'colombo', 'wijaya mawatha', '3'),
(4, 'saliya', 'kandy', 'wijayarama mawatha', '4'),
(5, 'samaranayaka', 'rathnapura', 'rahula mawatha', '5'),
(6, 'samarasekera', 'abilipitiya', 'anandharama mawatha', '6'),
(7, 'sakura', 'tokiyo', 'molpe', '7'),
(8, 'shrawashthi', 'jafna', '8th lane', '8'),
(9, 'anura', 'anuradhapura', '9th lane', '9'),
(10, 'abaya', 'abepussa', '1st lane', '10'),
(11, 'balasuriya', 'gampaha', '2nd lane', '11'),
(12, 'bharana', 'homagama', '3rd lane', '12'),
(13, 'bhathiya', 'siyabalapura', '4th lane', '13'),
(14, 'santhush', 'siyabalawewa', 'A1', '14'),
(15, 'kamal', 'kundasale', 'A2', '15'),
(16, 'kamani', 'katugasthota', 'A3', '16'),
(17, 'kumudu', 'kuliyapitiya', 'A5', '17'),
(18, 'kumara', 'kumana', 'A6', '18'),
(19, 'null', 'null', 'null', 'null'),
(20, '1', '1', '1', '1'),
(21, 'arjuna', '1', 'banadaranayaka mawatha', 'weyangoda'),
(22, 'sanath', 'mathara', 'uyanwaththa', '101'),
(23, 'sangakkara kumara', 'colombo 07', 'agulana mw', '154'),
(24, 'K.sangakkara', '1', 'mal renu mawatha', 'udu nuwara'),
(25, 'Arnold Swasanager', 'calfornia', 'back', '22'),
(26, 'murali', 'kandy', 'asasa mw', '1'),
(27, 'wilson', 'welinton', 'wilson wkins', '43'),
(28, 'charmara', 'hambanthota', 'nuwan mw', '34'),
(29, 'elton jhon', 'newyork', 'eminum mw', '76'),
(30, 'tom and jerry', 'losangalies', 'nikodo mw', '54'),
(31, 'JQuery', 'showtland', 'black berry', '37'),
(32, 'mihira', 'anytown', 'any', '23'),
(33, 'Jenaral SF', 'saliyapura', 'gajaba', '12'),
(34, 'jasica alba', 'newyork', 'black bery', '123');




you have to download ResizableTitleWindow.swc from internet



<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
backgroundColor="#FFFFFF"
layout="absolute"
xmlns:adobe="http://www.adobe.com/2006/fc">

<mx:HTTPService id="httpXmlDataService"
url="http://localhost:8080/EmpEntApp-war/EmployeView"
resultFormat="e4x"
result="resultHandler(event)"
fault="faultHandler(event)"
useProxy="false">
<mx:request>
<first>{first.text}</first>
</mx:request>
</mx:HTTPService>

<mx:HTTPService id="httpDataServiceInsert"
url="http://localhost:8080/EmpEntApp-war/EmployeCreate"
resultFormat="e4x"
result="resultHandler(event)"
fault="faultHandler(event)"
useProxy="false">
<mx:request>
<name>{name1.text}</name>
<!--<address>{address.text}</address>-->
<no>{no.text}</no>
<street>{street.text}</street>
<town>{town.text}</town>
</mx:request>
</mx:HTTPService>

<mx:HTTPService id="httpDataServiceEdit"
url="http://localhost:8080/EmpEntApp-war/EmployeEdit"
resultFormat="e4x"
result="resultHandler(event)"
fault="faultHandler(event)"
useProxy="false">
<mx:request>
<nameEdit>{nameEdit.text}</nameEdit>
<noEdit>{noEdit.text}</noEdit>
<streetEdit>{streetEdit.text}</streetEdit>
<townEdit>{townEdit.text}</townEdit>
<employeIdEdit>{employeIdEdit.text}</employeIdEdit>
</mx:request>
</mx:HTTPService>

<mx:ApplicationControlBar dock="true">
<mx:Label text="Background Color:"/>
<mx:ColorPicker id="colorPicker"
creationComplete="colorPicker_creationComplete(event)"
change="colorPicker_change(event)"/>
<mx:Button id="cmdViewTEmpitleWindow"
label="Employe Details"
click="titleWindow_open()"/>

</mx:ApplicationControlBar>

<adobe:ResizableTitleWindow id="empView"
x="134"
y="39"
showEffect="true"
addedEffect="zoomEmpAnimation"
height="335"
width="750">
<mx:ApplicationControlBar horizontalAlign="left"
width="250">
<mx:Button id="viewCmd"
label="switch view"
width="120"
click="changeView()"
x="500"/>

<mx:TextInput width="100"
id="first"
enter="retrive_data();"/>
</mx:ApplicationControlBar>
<mx:ViewStack id="viewstack1"
width="700"
height="250"
x="0"
y="41">
<mx:Canvas label="gride"
width="100%"
height="100%"
showEffect="{showEffect}"
id="gride">

<!-- this is the Rotate animation code addedEffect="down" -->
<mx:DataGrid showEffect="true"
addedEffect="down"
x="9"
width="682"
height="220"
editable="true"
headerHeight="20"
dataProvider="{xmldata.employe}"
y="4">
<mx:columns>
<!--<mx:DataGridColumn headerText="ID"
dataField="@employeId"
id="employeId"
width="75"/>-->

<mx:DataGridColumn headerText="Name"
dataField="name"
editable="false"/>
<mx:DataGridColumn headerText="No"
labelFunction="displayAddressNo"
editable="true"
width="75"/>
<mx:DataGridColumn headerText="Street"
labelFunction="displayAddressStreet"
editable="true"/>
<mx:DataGridColumn headerText="Town"
labelFunction="displayAddressTown"
editable="true"/>
<mx:DataGridColumn headerText="Address"
width="200"
labelFunction="displayFullAddress"
editable="true"/>
<!--<mx:DataGridColumn headerText="URL" itemRenderer="urlRenderer"/>
<mx:DataGridColumn headerText="URL" itemEditor="{inlineEditor}" editorDataField="@employeId" dataField="@employeId"/>-->
<mx:DataGridColumn dataField="@employeId"
width="50"
editable="false"
headerText="Edit">

<mx:itemRenderer>
<mx:Component>
<mx:LinkButton click="handleClick();"
label="{data.@employeId}">
<mx:Script>
<![CDATA[
import mx.controls.Text;
import mx.controls.Alert;
import flash.profiler.showRedrawRegions;
import mx.core.Container;
import mx.core.Application;
import mx.events.CloseEvent;

public function handleClick():void
{
Alert.yesLabel="Edit";
Alert.noLabel="Back";
Alert.show("Do you want to edit details of\n Mr:" + data.name + "\n employe id :" + data.@employeId, "Employe Information", Alert.YES | Alert.NO, null, handleAlert, null, Alert.YES);
}

public function handleAlert(event:Object):void
{
if (event.detail == Alert.YES)
{
Application.application.viewstack1.selectedIndex=2;
//Alert.show("Name : "+data.name+"\nAddress : "+data.address.no+data.address.street+data.address.town+"\nEmploye ID : "+data.@employeId);
Application.application.nameEdit.text=data.name;
//Alert.show("acheived... Application.application.name1.text=data.name;");
Application.application.streetEdit.text=data.address.street;
Application.application.townEdit.text=data.address.town;
Application.application.noEdit.text=data.address.no;
Application.application.employeIdEdit.text=data.@employeId;
//Alert.show("changeView acheived...");

// YES button was clicked
}
else if (event.detail == Alert.NO)
{
// NO button was clicked
}
}
]]>
</mx:Script>
</mx:LinkButton>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

<!-- //navigateToURL(new URLRequest(data.url))
<mx:LinkButton textAlign="center"
label="Edit"
click="{navigateToURL(new URLRequest('http://localhost:8080/EmpEntApp-war/EmployeView?first='+xmldata.employe.@employeId));}"/>
//click="navigateToURL(new URLRequest('http://localhost:8080/EmpEntApp-war/EmployeView?first='+data.@employeId))"

-->


</mx:columns>
</mx:DataGrid>


</mx:Canvas>
<mx:Canvas label="detail"
width="100%"
height="100%"
showEffect="{showEffect}"
id="detail">
<mx:Form x="8"
y="4"
label="Create Employe Profile"
width="300">
<mx:FormItem label="Name:">
<mx:TextInput id="name1"
width="100"/>
</mx:FormItem>

<mx:FormItem label="No:">
<mx:TextInput id="no"
width="100"/>
</mx:FormItem>
<mx:FormItem label="Street">
<mx:TextInput id="street"
width="100"/>
</mx:FormItem>
<mx:FormItem label="Town">
<mx:TextInput id="town"
width="100"/>
</mx:FormItem>
<mx:FormItem>
<mx:TextInput visible="true"
editable="false"
id="employeId"
width="100"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Create"
width="100"
id="submitCmd"
click="sendToServer();"/>
</mx:FormItem>
</mx:Form>
</mx:Canvas>
<mx:Canvas label="Edit"
width="100%"
height="100%"
showEffect="{showEffect}"
id="detailEdit">
<mx:Form x="8"
y="4"
label="Edit Employe Profile"
width="300">
<mx:FormItem label="Name:">
<mx:TextInput id="nameEdit"
width="100"/>
</mx:FormItem>

<mx:FormItem label="No:">
<mx:TextInput id="noEdit"
width="100"/>
</mx:FormItem>
<mx:FormItem label="Street">
<mx:TextInput id="streetEdit"
width="100"/>
</mx:FormItem>
<mx:FormItem label="Town">
<mx:TextInput id="townEdit"
width="100"/>
</mx:FormItem>

<mx:FormItem label="Employe ID">
<mx:TextInput visible="true"
editable="false"
id="employeIdEdit"
width="100"/>
</mx:FormItem>
<mx:FormItem>
<mx:Button label="Save"
width="100"
id="submitCmdEdit"
click="sendEditToServer();"/>
</mx:FormItem>
</mx:Form>
</mx:Canvas>

</mx:ViewStack>

<mx:Image id="animateImage"
visible="false"
includeInLayout="false"/>

</adobe:ResizableTitleWindow>

<adobe:ResizableTitleWindow id="graphView"
x="736"
y="284"
showEffect="true"
addedEffect="zoomEmpAnimation"
height="235"
width="250">


<mx:Script>
<![CDATA[
import mx.charts.*;
import mx.controls.Alert;
import mx.charts.series.items.*;
import mx.graphics.*;
import mx.collections.ArrayCollection;
[Bindable]
public var expensesAC:ArrayCollection=new ArrayCollection([{Month: "January", Profit: 2000, Expenses: 1500, Amount: 195}, {Month: "February", Profit: 1000, Expenses: 200, Amount: 160}, {Month: "March", Profit: 800, Expenses: 500, Amount: 230}, {Month: "April", Profit: 500, Expenses: 300, Amount: 150}, {Month: "May", Profit: 700, Expenses: 450, Amount: 210}, {Month: "June", Profit: 900, Expenses: 500, Amount: 179}]);

[Bindable]
private var expensesAC1:ArrayCollection=new ArrayCollection([{Month: "Jan", Profit: 2000, Expenses: 1500, Amount: 450}, {Month: "May", Profit: 2400, Expenses: 1575, Amount: 500}, {Month: "April", Profit: 1500, Expenses: 1300, Amount: 350}, {Month: "May", Profit: 1700, Expenses: 1450, Amount: 260}, {Month: "June", Profit: 1900, Expenses: 1200, Amount: 399}]);

private function labelFunc(v:BarSeriesItem, index:int):String
{
return BarSeries(v.element).displayName + ":" + v.xNumber;
}
]]>
</mx:Script>

<mx:Panel title="Bar chart showing per item labels"
width="100%"
height="100%"
layout="horizontal">
<mx:BarChart id="Barchartold"
height="100%"
width="100%"
paddingLeft="5"
paddingRight="5"
showDataTips="true"
dataProvider="{expensesAC}">

<mx:verticalAxis>
<mx:CategoryAxis categoryField="Month"/>
</mx:verticalAxis>

<mx:series>
<mx:BarSeries id="profitseries1"
xField="Profit"
displayName="Profit"
labelPosition="inside"
labelFunction="labelFunc"/>
<mx:BarSeries id="expenseseries1"
xField="Expenses"
displayName="Expenses"
labelPosition="inside"
labelFunction="labelFunc"/>
<mx:BarSeries id="amountseries1"
xField="Amount"
displayName="Amount"
labelPosition="inside"
labelFunction="labelFunc"/>
</mx:series>
</mx:BarChart>
<mx:BarChart id="Barchartout"
height="100%"
width="100%"
paddingLeft="5"
paddingRight="5"
showDataTips="true"
dataProvider="{expensesAC}">

<mx:verticalAxis>
<mx:CategoryAxis categoryField="Month"/>
</mx:verticalAxis>

<mx:series>
<mx:BarSeries id="profitseries2"
xField="Profit"
displayName="Profit"
labelPosition="outside"
labelFunction="labelFunc"/>
<mx:BarSeries id="expenseseries2"
xField="Expenses"
displayName="Expenses"
labelPosition="outside"
labelFunction="labelFunc"/>
<mx:BarSeries id="amountseries2"
xField="Amount"
displayName="Amount"
labelPosition="outside"
labelFunction="labelFunc"/>
</mx:series>
</mx:BarChart>

</mx:Panel>


</adobe:ResizableTitleWindow>


<mx:Style source="my.css"/>


<mx:Script>
<![CDATA[
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.*;
import mx.controls.Alert;
import mx.events.ColorPickerEvent;
import mx.events.CloseEvent;
import mx.controls.Button;
import mx.managers.PopUpManager;
import mx.managers.PopUpManager;
import mx.containers.TitleWindow;
import flash.geom.Point;

[Bindable]
public var xmldata:XML;

private function sendToServer():void
{
insert_data();
changeView();
retrive_data();
retrive_data();
}

private function sendEditToServer():void
{
edit_data();
viewstack1.selectedIndex=0;
retrive_data();
retrive_data();
}

private function displayAddressNo(row:Object, column:DataGridColumn):String
{
return row.address.no;
}

private function displayAddressTown(row:Object, column:DataGridColumn):String
{
return row.address.town;
}

private function displayAddressStreet(row:Object, column:DataGridColumn):String
{
return row.address.street;
}

private function displayFullAddress(row:Object, column:DataGridColumn):String
{
return row.address.no + "," + row.address.street + "," + row.address.town;
}

public function changeView():void
{
animate();

//viewstack1.selectedIndex=0
if (viewstack1.selectedChild == detail)
{
viewstack1.selectedChild=gride;
//viewCmd.label="Detail View";
first.visible=true;
//set to insert mode,create all as empty fields
//mode.text="insert";
//name1.text="";
//no.text="";
//town.text="";
//street.text="";
//employeId.text="";
}
else if (viewstack1.selectedChild == detailEdit)
{
viewstack1.selectedChild=gride;
}
else
{

viewstack1.selectedChild=detail;
//viewCmd.label="Gride view";
first.visible=false;
}
}

private function retrive_data():void
{
httpXmlDataService.send();
}

private function insert_data():void
{
httpDataServiceInsert.send();
}

private function edit_data():void
{
httpDataServiceEdit.send();
}

private function faultHandler(event:FaultEvent):void
{
mx.controls.Alert.show(event.fault.message, "Error in getting result");
}

private function resultHandler(event:ResultEvent):void
{
xmldata=event.result as XML;
}

private function titleWindow_close():void
{
PopUpManager.removePopUp(this);

}

private function titleWindow_open():void
{
PopUpManager.addPopUp(empView, this, false); //false--true is lock background
PopUpManager.centerPopUp(empView);

//animation effect code
//customMove.end();
//customMove.play();
//animation effect code

//animation effect code
//zoomEmpAnimation.play();
//blurAnimation.play();
//over.play();
//animation effect code

}

private function colorPicker_creationComplete(evt:Event):void
{
colorPicker.selectedColor=Application.application.getStyle("backgroundColor");
}

private function colorPicker_change(evt:ColorPickerEvent):void
{
Application.application.setStyle("backgroundColor", colorPicker.selectedColor);
}
]]>
</mx:Script>


<mx:Parallel id="customMove"
target="{empView}">
<mx:Move duration="1000"
xTo="{(stage.width - empView.width) / 2}"
yTo="{(stage.height - empView.height) / 2}"/>
<mx:WipeRight duration="1000"/>
</mx:Parallel>

<mx:Parallel id="zoomEmpAnimation"
target="{empView}">
<mx:Zoom id="zoomEmp"
duration="500"
zoomHeightFrom="0.01"
zoomHeightTo="1.0"
zoomWidthFrom="0.01"
zoomWidthTo="1.0"/>
</mx:Parallel>

<mx:Dissolve alphaFrom="1.0"
alphaTo="0.1"
color="#ffff00"/>

<mx:Blur id="blurAnimation"
duration="300"
blurYFrom="1.0"
blurYTo="20.0"/>

<mx:Parallel id="over">
<mx:Zoom duration="100"
zoomHeightTo="1.3"
zoomWidthTo="1.3"/>
<mx:Blur duration="1000"/>
</mx:Parallel>
<mx:Rotate id="down"
angleFrom="0"
angleTo="360"
duration="1500"/>
<mx:Zoom id="out"
duration="200"
zoomHeightTo="1"
zoomWidthTo="1"/>








<mx:Script>
<![CDATA[
import mx.effects.easing.Exponential;
import mx.graphics.ImageSnapshot;

private function animate():void
{
animateImage.width=viewstack1.width;
animateImage.height=viewstack1.height;
animateImage.source=new Bitmap(ImageSnapshot.captureBitmapData(viewstack1));
animateImage.visible=true;
animateImage.includeInLayout=true;

switch ("down")
{
case "up":
contentMove.xFrom=0;
contentMove.xTo=0;
contentMove.yFrom=viewstack1.height;
contentMove.yTo=0;

imageMove.xFrom=0;
imageMove.xTo=0;
imageMove.yFrom=0;
imageMove.yTo=-viewstack1.height;
break;

case "down":
contentMove.xFrom=0;
contentMove.xTo=0;
contentMove.yFrom=-viewstack1.height;
contentMove.yTo=0;

imageMove.xFrom=0;
imageMove.xTo=0;
imageMove.yFrom=0;
imageMove.yTo=viewstack1.height;
break;

case "left":
contentMove.xFrom=viewstack1.width;
contentMove.xTo=0;
contentMove.yFrom=0;
contentMove.yTo=0;

imageMove.xFrom=0;
imageMove.xTo=-viewstack1.width;
imageMove.yFrom=0;
imageMove.yTo=0;
break;

default: //right
contentMove.xFrom=-viewstack1.width;
contentMove.xTo=0;
contentMove.yFrom=41;
contentMove.yTo=41;

imageMove.xFrom=0;
imageMove.xTo=viewstack1.width;
imageMove.yFrom=41;
imageMove.yTo=41;
break;
}

// toggleVisibility();
}

private function toggleVisibility():void
{
viewstack1.selectedIndex=(viewstack1.selectedIndex + 1) % viewstack1.numChildren;
contentMove.target=viewstack1.selectedChild;
}
]]>
</mx:Script>


<mx:Parallel id="showEffect">
<mx:Move id="contentMove"/>
<mx:Move id="imageMove"
target="{animateImage}"/>
<mx:effectEnd>
<![CDATA[
animateImage.visible=false;
animateImage.includeInLayout=false;
]]>
</mx:effectEnd>
</mx:Parallel>



<mx:Style>
Alert {
modalTransparencyBlur: 5;
modalTransparency: 0.6;
modalTransparencyColor:#ffffff;
modalTransparencyDuration: 300;
}
</mx:Style>

</mx:Application>


Labels: ,