Using the Flex 2 Framework

Language

Flex uses two programming languages: MXML and ActionScript.

MXML

MXML is unique to Flex and designed specifically to describe properties in Flex layouts, though it’s not limited to describing visual objects. MXML is an extension of XML, where each tag represents a different Flex component. You can nest components inside each other to provide a variety of different layout and interface options. Other nonvisual components, such as web services interfaces, transitions, and style sheet specifications can also be written in MXML.

ActionScript 3.0

ActionScript 3.0 is a rich and robust programming language useful for complex data manipulation. It’s the latest version of the Flash Player’s ActionScript language, which was originally based on the ECMA Script 1 specifications for scripting languages and resembled JavaScript. The current implementation has come a long way, and looks much more like Java than JavaScript.

You can write ActionScript 3.0 methods to process data, react to events, perform transitions, or even draw shapes and components on the screen. It’s customarily implemented to enhance the functionality of MXML components.

ActionScript and MXML work very nicely together. While all Flex applications must begin with at least a single MXML file, ActionScript can be nested within MXML components or imported from separate files. In the intended implementation, MXML provides the structure and organization in an application, while ActionScript provides access to advanced features, processing, and data manipulation methods.

Other Development Integration

How to Integrate Flex with Your Server Stack

Flex isn’t tied to a specific technology; rather, it defines common interfaces for connecting to multiple independent data sources, which makes it a good player in a service-oriented architecture (SOA). Flex connects seamlessly to most backend services in a service-oriented architecture, whether the underlying technology is Java, PHP, Ruby, or .NET. Flex provides several nonvisual components which you can use to connect to a variety of web-based data sources.

What Java Developers Should Know

Most Java developers will find that their Java experience makes the transition to Flex application development relatively easy. Flex is specifically designed to make the tools Java developers are used to available, and the syntax of ActionScript 3 is remarkably similar to that of Java. Additionally, Flex takes advantage of a number of design patterns and software best practices that Java developers will feel comfortable using.

The controller and event listener design patterns utilized by Flex components will be familiar to Java programmers with Abstract Window Toolkit (AWT) or Swing development experience. It may be less familiar to JSP developers who are used to JSP tag libraries and templates and not a fully OO client server interaction. For these programmers, it will be a pleasant experience since they have the full power of object-oriented programming and full suite of UI controls from which to quickly build powerful UIs.

Furthermore, Java developers will find that using Flex with a Java backend creates a much cleaner separation between client and server than in other web-development frameworks like Struts, Tapestry, and JSF. Java developers will discover a number of options to connect a Flex client to their favorite Java server stack, whether that’s JBoss or Spring, Hibernate, straight JDBC, or some other server. Whatever the choice for a Java server backend, it’s easy to expose Java server objects to Flex frontend-based (via http or WSDL) web services or directly as Flash remoting objects.

Finally, Java developers with no Flash experience may be unfamiliar with vector graphics, movie player, and the animation Flash roots of Flex. However, many of these have been removed or simplified in the Flex framework and replaced with easy-to-use effects and components. Java developers should learn as much as possible about the Flash roots of Flex to fully utilize the expansive set of rich tools available.

What .NET Developers Should Know

Similar to Java developers, many .NET developers will find themselves comfortable in the underlying language of Flex and ActionScript 3, because of a shared similarity with C# and VB.NET. Like Java developers, .NET developers will feel comfortable with the object-oriented aspects of AS3, from classes and interfaces to getters and setters. The .NET developers familiar with ASP development will experience a similar transition out of the HTML/CSS template world to a full-featured client-side UI experience. For those who’ve done Windows Forms and VB UI development, the learning curve will be less, as they’ll be used to writing code behind a set of visual components and traditional client server design patterns.

One potential obstacle for .NET developers is to see Flex as a non .NET technology, since most Flex applications are built with Java and PHP server backends. .NET developers will be happy to know that Flex operates well with web services built and deployed on .NET. In fact, it’s easy for Flex applications to consume simple http web services created in .NET. Simply create the web service as normal in .NET by marking your functions as WebMethod. This exposes a URL like: http://localhost/MyWebService/MyWebService.asmx?WSDL

In Flex, it’s easy to consume a web service with the WebService component, allowing Flex to call any WSDL-based web service. Another option is to create a non-WSDL, http-based service in .NET and use the Flex HTTPService component to call the data. You can also expose .NET objects as Flash Remoting objects that are serialized across the network and consumed by the Flex RemoteObject component. Whatever option you choose, you’ll find proven methods of using Flex as a frontend to .NET server-side applications.

Finally, .NET developers who’ve followed and are learning the Windows Presentation Framework (WPF) on which the user interface for Windows Vista is built, will already be interested in and familiar with animation, multimedia support, 3D, advanced visual and sound effects, vector images, and many other advanced features of building user experiences with Flash and Flex. They should investigate Flex as an alternative environment on which to build advanced rich user experiences.

What Flash Developers Should Know

If you’re a Flash developer who learned how to code in the Flash IDE, you have a slight learning curve ahead of you. To start, Flex obscures the timeline from you and forces a more traditional OOP methodology. If you understand the basic concepts of MVC (Model, View, Controller) architecture, you’re on your way to understanding how the Flex component framework works. Each component has the notion of an event listener and event dispatcher.

Licensing Costs

Open Source: $0.00

In contrast to the previous versions, Flex 2.0 is free. You can design, build, and deploy commercial Flex 2.0 applications and never spend a dime on licensing. Adobe opened up the platform to gain a broad developer adoption and they hope to earn revenue on developer tools and servers for larger teams working on complex projects.

Flex Builder: $499

Flex Builder is an integrated development environment, or IDE, for Flex Developers. It’s built on top of the Open Source Eclipse IDE used primarily for Java development. It has a feature set similar to other IDE’s like Microsoft Visual Studio, NET Beans and JBuilder. Flex Builder is by no means required for Flex development—all of the source code can be written by any text editor—but its rich set of development views and tools make it very useful in Flex development. Flex Builder also offers a WYSIWYG design view that allows developers to graphically drag and place components in their application as desired. This is especially useful for new developers who want to quickly learn how the different layout components can be used to make clean interfaces.

Charting Components: $299 or $749 for the FB/Charting bundle

For a small fee, Adobe offers a set of charting components that you can use in production. The charting package contains all standard chart types and all of the classes required for manipulating them. You can test it for free, but your charts will contain the words “Flex Charting Trial” until you purchase a serial number from Adobe.

Flex Data Services: $0.00-$20,000

Flex Data Services is a set of Java libraries provided by Adobe to make it easy for Flex applications to connect to standard J2EE server-side applications. Flex Data Services has several pricing options, from the free single-CPU license up to a $20,000 enterprise edition.

Flash Media Server: $4,500 per CPU

Flash Media Server manages streaming media from your server and integrates well with Flex applications. Adobe currently offers a free evaluation version with no expiration date, but the full commercial version is $4,500 as of the time of this publication.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.177.85