日志文章

2007年08月30日 16:59:14

flex...Building a Flex Application

Building a Flex Application

Application model
...........
How Flex fits the MVC models
...........
Working with a web server
A web application server, such as JRun, ColdFusion, or PHP, can dynamically generate pages that host your Flex applications.
You require a J2EE application server or servlet container, such as JRun, Tomcat, or WebSphere, to run Flex Data Services.
You can optionally install the integrated JRun J2EE server when you install Flex Data Services. The integrated JRun server is a development-only version of the JRun 4 application server that is not intended for deployment. The integrated version of JRun also includes the JRun Web Server (JWS) that you can use to handle HTTP requests.
Typical application development steps
..........
Deploying applications
...........
The Flex programming model





Relationship of the Flex class hierarchy to MXML and ActionScript
Flex is implemented as an ActionScript class library. That class library contains components (containers and controls), manager classes, data-service classes, and classes for all other features. You develop applications using the MXML and ActionScript languages with the class library.
MXML tags correspond to ActionScript classes or properties of classes. Flex parses MXML tags and compiles a SWF file that contains the corresponding ActionScript objects. For example, Flex provides the ActionScript Button class that defines the Flex Button control. In MXML, you create a Button control using the following MXML statement:
Adding ActionScript to a Flex application
You use ActionScript for the following purposes:Handling events The Flex user interface is event-driven. For example, when a user selects a Button control, the Button generates an event. You handle events by defining functions in ActionScript called event listeners. Your event listener could open a window, play a SWF file, or perform whatever action is necessary for your application.Handling errors You handle runtime errors in ActionScript. You can detect data validation errors and signal the error to the user, resubmit a request to the server, or perform some other actions based on your application.Binding data objects to a Flex control within an MXML statement You can use data binding to populate a data model from a Flex component, populate a component from a data model, or copy data from one component to another.Defining custom components You can derive custom components from the Flex component class hierarchy to create components specific to your application requirements.

data binding
the value inside the curly braces ({ }) binds the text property of the TextArea control to the text property of a TextInput control:
Controlling application appearance
Flex defines a default appearance that you can use as is in an application, or modify to define your own specific appearance. As part of modifying the appearance, you can change some or all of the following:
Sizes Height and width of a component or application. All components have a default size. You can use the default size, specify your own size, or let Flex resize a component as part of laying out your application.
Styles Set of characteristics, such as font, font size, text alignment, and color. These are the same styles as defined and used with Cascading Style Sheets (CSS).
Skins Symbols that control a component's appearance. Skinning is the process of changing the appearance of a component by modifying or replacing its visual elements. These elements can be made up of images, SWF files, or class files that contain drawing API methods.
Behaviors Visible or audible changes to a Flex component that an application or user action triggers. Examples of behaviors are moving or resizing a component based on a mouse click.
View states In many Rich Internet Applications, the interface changes based on the task the user is performing. View states let you vary the contents and appearance of a component or application by modifying its base content.
Transitions转换(效果) Transitions define how a change of view state appears on the screen. You define a transition using the effect classes, in combination with several effects designed explicitly for handling transitions.

Working with data services
Flex is designed to interact with several types of services that provide access to local and remote server-side logic. For example, a Flex application can use AMF?? to connect to a web service that uses the Simple Object Access Protocol (SOAP), an HTTP URL that returns XML, or for Flex Data Services, a Java object that resides on the same application server as Flex. The MXML components that provide data access are called data service components. MXML includes the following types of data service components:
WebService Provides access to SOAP-based web services.
HTTPService Provides access to HTTP URLs that return data.
RemoteObject Provides access to Java objects (Java Beans, EJBs, POJOs) by using the AMF protocol. This option is only available with Flex Data Services or Macromedia ColdFusion MX 7.0.2.


Building a Flex Data Services Application

About Flex Data Services

About Flex Data Management Service

......................

About RPC services

.......................

About the development environment


Directory
Description
web_app
(root directory or WAR root)

Contains the WEB-INF directory and all files that must be accessible by the user's web browser, such as MXML files, JSPs, HTML pages, Cascading Style Sheets, images, and JavaScript files. You can place these files directly in the web application root directory or in arbitrary subdirectories that do not use the reserved name WEB-INF.

/WEB-INF
Contains the standard web application deployment descriptor (web.xml) that configures Flex. This directory might also contain a web application deployment descriptor that is vendor specific.

/WEB-INF/flex

Contains Flex configuration files.

/WEB-INF/flex/user_classes

Contains custom ActionScript classes and MXML components.

/WEB-INF/lib

Contains Flex server code in Java Archive (JAR) files.

/WEB-INF/flex/frameworks

Contains the SWC component file, such as framework.swc and rpc.swc, that contains the Flex application framework files.



Using Flex Charting Components
..........

Using MXML


Using ActionScript



Tags: JAVA  

类别: flex/AJAX |  评论(0) |  浏览(479) |  收藏
发表评论
看不清楚,换一张