Main

Flex Archives

June 10, 2007

Cerchi una consulenza su Flex 3, AIR, Livecycle data services e Java per lo sviluppo di RIA ? E' nata Comtaste Consulting

Dopo oltre un decennio di attività da free lance per lo sviluppo e la consulenza su Flash, Flash Media Server e, successivamente, Flex (fin dalla versione 1) e Flash Lite, ho formato e dirigo un team di professionisti che hanno una profonda conoscenza di queste tecnologie ed un solido background in Java, EJB3, Struts, Hibernate, POJO e Spring in ambiente Java Enterprise (J2EE).
Oltre a frequenti attività di supporto ad Adobe in importanti progetti nell’area EMEA (EuropeMiddleEastAfrica), questo team di consulenza e sviluppo è stato ingaggiato più volte da prestigiose aziende worldwide per consulenza in materia di analisi, sviluppo e ottimizzazione di applicazioni in cui gli aspetti gestionali e di sicurezza tipici del mondo enterprise integrano saggiamente l’attenzione alla user experience che è il fulcro dell’approccio RIA (Rich Internet Applications).

Se hai bisogno di assistenza per un'applicazione interna o vuoi rendere un'applicazione eistente più ricca e accattivante, o se hai un'idea che vuoi realizzare utilizzando le più moderne, efficaci ed affidabili tecnologie disponibili sul mercato quello che stai cercando è il mio team! Forniamo consulenza e assistenza in ogni parte del mondo, on site e off site, both on a Time&Material and on a TurnKey basis.

Per contattarmi in merito ad attività di consulenza, scrivi una email a consulting[ AT ]comtaste.com

June 11, 2007

Flex 3 and Flash Player 9 update on the Labs

Today Adobe released a lot of new technologies on its Labs section: Flex 3 Flash Player 9 update 3 and Adobe AIR (Adobe Intergrated Runtime).

flex3_fx_124x120.jpgFlex 3 is the one we are waiting for and the new features of this release are a lot and Adobe made an excellent work. As you can read from the Introduction to Flex 3 article by Matt Chotin :
the Flex 3 release is divided into four major themes: designer/developer workflow, working with data, Adobe AIR applications, and platform evolution. Let's quickly review some of the highlights:

* Native support for Adobe AIR – Flex 3 introduces new components and incorporates the Adobe AIR development tools into the SDK and Flex Builder.
* Persistent framework caching – You can make Flex 3 applications as small as 50K when leveraging the new Flash Player cache for Adobe platform components.
* Flex Builder productivity enhancements – Flex Builder 3 introduces refactoring support, new profilers for performance and memory tuning, and code generation tools for data access.
* Integration with Creative Suite 3 – The Flex Component Kit for Flash CS3 allows Flash CS3 users to build components that can be seamlessly integrated into a Flex application, while Flex Builder 3 adds new wizards for importing assets from CS3 applications as skins.
* Advanced DataGrid – The Advanced DataGrid is a new component that adds commonly requested features to the DataGrid such as support for hierarchical data, and basic pivot table functionality.
* First steps toward open source Flex. As a first step toward making Flex an open source project, we've opened up the Flex and Flex Builder bug tracking system to the public, as well as published detailed roadmap information.


Emmy Huang wrote on his blog about the the Flash Player 9 update 3 and its 300 bug fixes :

The Flash Player 9 update 3 beta (9.0.60.120) has a little something for everyone. In addition over 300 bug fixes, and the new player cache for Adobe platform components that Ted mentioned on Thursday, we've added performance enhancements that will improve your video and interactive content. The hot new feature is full-screen mode with hardware scaling, which can be used to deliver significant improvements in visual quality and performance for video. If you're interested in the technical details behind this feature and the rest of the performance enhancements, Tinic will be talking about the under-the-hood details on his blog and has also written an article on Adobe Labs on the new API for accessing this feature. There is also a video you can use to see the difference between software and hardware full-screen mode. Check back, if it hasn't gone live yet...

June 12, 2007

LiveCycle Data Services ES 2.5 Documentation

Past week the Flex Doc Team at Adobe released the documentation for LiveCycle Data Services Es 2.5. The documentation was realeased in livedocs format so you were able to read on the web.

Randy Nielsen, the Learning Resources Manager at Adobe Systems Incorporated, send me an email to point me out that the LiveCycle Data Services Developer’s Guide has been released in PDF format.
So we're now ready to download and print it !

This is the entire LiveCycle Data Services documentation :

* Getting started - http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcds/getstarted_1.html
* LiveCycle Data Services Developer’s Guide - [ LiveDocs ] | [ PDF ]
* LiveCycle Remoting - http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/sdkHelp/Invoking_LiveCycle/invokingLCRemoting.2.1.html
* LiveCycle ES ActionScript Language Reference (includes Flash Player, Flex SDK 2.0.1 hotfix 2, Data Services, and LiveCycle Form Guide classes) - http://livedocs.adobe.com/livecycle/es/sdkHelp/common/langref/index.html
* LiveCycle Data Services JavaDoc - http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcdsjavadoc


Flex Doc Team rocks !
They made an excellent job for the Flex and LiveCycle Data Services Es 2.5 documentation.
Thanks guys !

June 14, 2007

Adobe AIR, Flex 3 and Integration between Fireworks,Photoshop and Flash CS3 with Flex. All of these topics at the AdobeLive 2007

Today is the second day of AdobeLiveConference here in Italy.
I'm here with Enrique (and some enormous mosquitos) in the business room of the AdobeLive and we're about to start our presentation.

Enrique will present Adobe AIR (formerly Apollo) and talk about Flex 3 and new features.

After his presentantion I'll show the integration of the Adobe CS3 with Flex and Flex Builder.
It's incredible how many things designers and creative are now able to do to help Flex developersin creating the user interface of Flex applications.
Using Photoshop CS3, Fireworks CS, Illustrator CS3 and Flash CS3 , of course, they can export graphic symbols, layouts and components for the Flex enviroment.

With Fireworks CS3 you can now use the Exoprt as MXML features to convert a PNG layouts into MXML code. You can do this using the new Flex Component Common Library (you can also create your own Flex components using an image and a javascript JSF file).
The MXML code generated from Fireworks is ready to be edited and customized by the developer in Flex Builder.

With Illustrator CS3 you can create vector based symbols and export them as SWF files, ready to be used and imported in Flex. For example you can export your vector symbols and then use them for change the style of a button flex component usign :

overSkin: Embed(source='styles.swf', symbol='mysymbol');
upSkin: Embed(source='styles.swf', symbol='mysymbol');
downSkin: Embed(source='styles.swf', symbol='mysymbol');

Then in Flash CS3 you can do whatever you want with the Flash CS3 Component Kit for Flex. You can interact in Flex with Flash contents, call public methods, refer to each single object.

If you're in Milan come to see the sessions !
They're great !

June 18, 2007

Form fields focus and keyboard events in Flex 3 form based applications

We're working on some projects in Flex where the use of the keyboard to navigate through the application is a key aspect.
They're both Flex 2 form based application

Our goals were :
- at the start up of the application give the focus to the first form field
- pressing the tab key cycling the focus through all the form fields

Although it seams like very simple, the focus in Flex 2 is not so easy.
We had strange behaviour that mostly depend on how the Internet Explorer uses the ActiveX contents :
- although when the application has been loaded the foucs was on the first field, pressing the tab key once, the focus goes outside the Flash Player applet to the browser controls

To solve the problem of the fucus lost by the Flash Player you can use this small workaround :

keyFocusChange="event.preventDefault();focusManager.getNextFocusManagerComponent(event.shiftKey).setFocus()"

The keyFocusChange is on the Application tag.

In order to make the focus in Flex 2 works for Internet Explorer, it's not enough to set it up using Javascript when the page loads.
Internet Explorer does not give you the ability to an ActiveX content to get the focus.
So for example in a Flex 2 application that has 3 text inputs when the last one has the focus and you click on the tab, the focus quits from the Flash Player 9 ActiveX and goes to the HTML page content.

That's a bad behavior for your application.

To overcome this problem we have to intercept the key pressed by the user and disable the default action of the browser to prevent the browser handling of the key.

Continue reading "Form fields focus and keyboard events in Flex 3 form based applications" »

Quality Control phase of enterprise Flex application with the The Flex Automation Framework

When you develop enterprise flex application the Quality Control phase (QC) is a fundamental aspect of each software development activity.
Flex and the LiveCycle Data Services ES include The Flex Automation Framework.

The Flex Automation Package provides developers with the ability to create Flex applications
that use the Automation API. You can use this API to create automation agents or to ensure
that your applications are ready for testing. In addition, the Flex Automation Package includes
support for Mercury QuickTest Professional (QTP) automation tool.

You can create applications and components that can be tested with automated testing tools
such as Mercury QuickTest Professional (QTP). This topic includes information intended for
Flex developers who write applications that are then tested by Quality Control (QC)
professionals who use these testing tools.

Continue reading the full Creating Flex Applications for Testing document.

Continue reading "Quality Control phase of enterprise Flex application with the The Flex Automation Framework " »

June 25, 2007

Flex 3,LiveCycle Data Services and Adobe AIR sessions at the MAX 2007 Conference

On the Adobe MAX 2007 blog has been published the pre-conference training day, a full-day hands-on training sessions. These are the tracks dedicated to Flex 3, Adobe AIR and LiveCycle Data Services :

Flex 3: Integrating with ColdFusion
This session provides ColdFusion developers with hands-on, practical experience connecting their Flex 3 client applications to remote, dynamic data provided by ColdFusion and LiveCycle Data Services.

Flex 3: Integration with Java
This session provides experienced application developers with hands-on, practical experience connecting their Flex front ends to remote, dynamic data using LiveCycle Data Services.

Flex 3: Developing Rich Client Applications
Get hands-on, practical experience using Flex.

Adobe Integrated Runtime (AIR): Bringing Rich Internet Applications to the Desktop
This full-day course will include everything you need to get started building applications with Adobe AIR.

June 29, 2007

Enterprise RIA development with Flex/LiveCycle Data Services and Java persistence

LiveCycle Data Services overview

LiveCycle Data Services, formerly known as Flex Data Services, is a powerful Adobe product that allows seamless interaction between a Flex client and any Java EE based server or most J2EE servers.
These services allow Java object or services to be called directly from the Flex client, in a transparent way: all the developer has to do, in the Flex code, is call remote services just like they were Flex functions or methods. All the problems related to marshalling / unmarshalling, mapping Flex and Java classes and types are solved internally by LiveCycle Data Services. For all of this to work, LiveCycle Data Services only requires some configuration to be provided, that will define the required behavior.
Using LiveCycle Data Services is, without doubt, one of the best approaches to consider in developing enterprise RIA applications, as it takes care, in an efficient and scalable way, of all the information exchanged by the Flex client and the Java server.

An eye on the server side

Connecting the client to the server being taken cared of, the development can just focus on creating a client and a server layer that handles any required business logic and persistence. LiveCycle Data Services is a Java EE web application, that has to be deployed into a Java EE container. From there it can access whatever server side required functionality and provide it to the Flex client. This kind of deploy ensures compatibility with existing Java EE application as well as with newly created applications. Connecting a LiveCycle application with an existing Java EE or J2EE application requires a little work, but we’ll cover it up in a future post.
The Java EE applications covered in the following blog posts will be the ones that use either Hibernate as a persistence manager or EJB3 in Java enterprise applications. We will see how to access Hibernate or EJB3 from LiveCycle Data Services, how to keep the data services separated from the Java business logic, using clean, modular and distinct components.

The world behind LiveCycle Data Service and Java

LiveCycle Data Services offers many possibilities, like accessing remote Java objects, binding client to server data sources, using publisher/subscribe messaging to communicate with the server, with or without JMS. Aside all these it’s also possible to configure a LiveCycle Data Services EE application to allow a controlled Flex client access to areas like Hibernate’s named queries, JNDI lookup or web server custom login.
LiveCycle Data Services offers numerous possibilities and can be configured and understood to get the outmost out of this potential.

Web resources
LiveCycle Data Services can be found here, http://www.adobe.com/products/livecycle/dataservices/, Hibernate http://www.hibernate.org/ contains all required resources and libraries. A commonly used Java EE web servers is Tomcat http://tomcat.apache.org/, while JBoss http://labs.jboss.com/ is an enterprise application container.

July 3, 2007

The advantages of going open source with Flex 3

As you probably know, Flex 3 is gonna be open source. But many developers are asking what that means.
There is a great interview by HowSoftwareisbuilt to Phil Costa who is the Director of Product Management for Flex and ColdFusion at Adobe, with responsibility for product definition and strategy of the Flex product line.

This is the answer Phil gave to the question : What are the advantages of going with more of an open source model — what are the advantages of taking something that hasn’t been open source and open sourcing it?

There are a few different elements to it. First, there’s the nature of the product itself. The core part of the product is try hard to internally test, and get all the bugs out, because it’s a development framework. By its nature, it gets used in a million different ways. It’s very hard to actually set up tests for all those ways and to chase down all the bugs.

So having an open source model will actually help us by having more people looking at the code and suggest changes based on their particular use-case. In one respect, we view it as a way of magnifying the QA resources we have, and also magnifying some of the bug-fixing resources. So, that’s a very tactical thing, but that is a proven advantage of an open source project.

The second element refers more to the evolution of the product. We’ve always tried to be very customer-centric in terms of designing the product, working with early adopters, niche users, and new users, to determine what things we should be adding to the product, to make sure that it fits their needs, both on the learning-curve side as well as the power-user side.

We decided that having a group of people who can directly influence that — or at least feel more deeply invested in it — was a good way to continue to evolve the product. With a developer product, the people who develop the product are also the users of the product, and there’s a very efficient feedback loop.

The third piece is more PR and marketing focused. Because people have to make a substantial investment in Flex — in terms of spending a lot of time developing an application and then making their application dependent on the Flex framework — they’re looking for an open source project or a set of standards. In the rich-ended application space, there aren’t really any standards, per se. They’re mostly looking for open source or de facto standards.

It’s become increasingly apparent, as the market has grown up, that to be successful as a platform you need to be an open source project, so that people view the product as being bigger than one individual company, or in some cases one individual product team. In a lot of ways, that was another requirement that more and more customers were raising; they love Flex but they wanted it to be bigger than just Adobe.

July 6, 2007

Creating an ObjectManager for improving the Flex interaction with Ajax or Javascript

In the latest years the growing demand for Rich Internet Applications submitted the following question to the developers' community: which to choose between the Ajax + JavaScript solution on one hand, and the Flash player based Adobe Flex technology on the other hand? The choice is definitely hard, as in most cases both solutions are suitable without particular indications or limitations, and we can insert both Ajax and Flex with no difficulty in the same web pages and applications in case of particular requirements.

What if we want that Flex interacts with Ajax/JavaScript in the same application to render a virtually unlimited user experience? What if we need our Flex application interacts with third parties' applications (e.g. Google Maps)?

Flex Ajax Bridge is a free small library which in such circumstances allows the developer to save many lines of code. Through Flex Ajax Bridge , which is now included in Adobe LiveCycle Data Services 2.5, you can make your ActionScript classes available to JavaScript without any additional coding. After you insert the library, essentially anything you can do with ActionScript, you can do with JavaScript.

While the functionalities offered by the External Interface class of the Flash Player can solve the easiest cases of ActionScript/JavaScript interaction, it is advisable to use the FABridge (Flex Ajax Bridge) in the most complex situations, in presence of user-defined classes or when we should define an interface to make JavaScript dialog with ActionScript and vice-versa.

In both cases we would face a little limit: it causes a problem trying to access Flex component just after html loads using body tags onload attributes while the swf files is not loaded yet.

It seems a marginal issue, but quite often it happens that our Flex movie will be initialized after the onload event is launched.

A possible solution could be the one of waiting a few seconds by using the Javascript function setTimeout(code,millisec,lang) , however what assures the movie will be ready in that time? If the movie were not ready, either an error is generated or the input to the Flex component goes lost.

The solution on the Flex 3 side is to make our Flex application disabled by using JavaScript :

To get the DOM object of our SWF file we'll use the ExternalInterface class standard function:

function thisMovie(movieName) {

if (navigator.appName.indexOf("Microsoft") != -1) {

return window[movieName];

} else {

return document[movieName];

}

}

In Flex we register the ActionScript method we want to call from the JavaScript side with the addCallback method :

ExternalInterface.addCallback("disableApplication", disableFunction);

We could call the method registering it on the creationComplete Flex event or any other system event.

Then we invoke the function that will call the method exposed by the ExternalInterface class, disableApplication in our case :

function disableMovie(movieName) {

var myMovie = thisMovie(movieName);

if(myMovie == null || myMovie.disableApplication == null)

{

setTimeout("disableFilter("+movieName+")", 100);

}

else

{

myMovie.disableApplication();

}

}

If the SWF file has not been loaded yet or the ExternalInterface.addCallback function has not been invoked on the Flex side, the movie will wait 100 milliseconds to disable the application again.

This method is known as busy waiting, and it's not a CPU intensive processing method, but it continuously calls the JavaScript function until it gets the value.
It's easy to implement this solution for small applications but it has several problems as soon as more and more applications run concurrently or there are race conditions. A more complicated solution to solve some of these problems can be to use some global variables to hold the objects returned by setTimeout() function, so we could call a clearTimeout() when needed.
As you can note, this method could generate unwanted effects when there are several functions and a medium size application.

This example is based on the ExternalInterface class but such a problem comes in also when using Flex Ajax Bridge, as mentioned in the Adobe Labs Wiki.

In the next part of the post we'll create an ObjectManager in JavaScript to handle this issue.

July 20, 2007

Conditional visualization in Cairngorm 2.x using the ChangeWatcher class

Data Binding is one of the most important and powerful flex features and the Cairngorm framework makes a full use of it in its Model View Controller design pattern.
In a standard and simple use of Cairngorm we have a view with some controls with dataProviders directly bound to the ModelLocator, if you don't have a clear view of how these things work you'll have a better outlook viewing the diagram on cairngormdocs.org

Sometimes we want to have in a view only some data that satisfies certain conditions, we have to filter the collection before passing it to the view. Flex gives the possibility to use a filter function associated to the collection; if you are considering a small application this is a viable solution but in an Enterprise RIA application probably we cannot apply a filter function, because that data source can be a data provider for different views that need the complete collection.
The flex ChangeWatcher class provides a complete different solution. From the flex 2 api: “
The ChangeWatcher class defines utility methods that you can use with bindable Flex properties. These methods let you define an event handler that is executed whenever a bindable property is updated.”

Let'see a tipical view in Cairngorm:

<MyView ... >

 <mx:DataGrid dataProvider=”{MyModelLocator.getInstance().myDataSource}”
itemRenderer=”MyItemRenderer” />

</MyView>

seq1.png


We have no way to intercept changes in the data source because the data binding will make changes effective in the view instantaneously.
Using the ChangeWatcher and the view helper we interpose a layer that prepares the data before sending them to the view.


The new View:


<MyView ... >

 <MyViewHelper id="myViewHelper" />

 <mx:ArrayCollection id=”myDataProvider” />

 <mx:DataGrid dataProvider=”{myDataProvider}”
itemRenderer=”MyItemRenderer” />

</MyView>


The ViewHelper:

package ...
{
...

 public class MyViewHelper extends ViewHelper
 {
   private var myChangeWatcher:ChangeWatcher;

   public function MyViewHelper() {

    myChangeWatcher = ChangeWatcher.watch(MyModelLocator.getInstance(), “myDataSource”, prepareDataProvider);
   }


   private function prepareDataProvider(event:Event) {

    var myAC:ArrayCollection = new ArrayCollection();
    for each(var item:Object in MyModelLocator.getInstance().myDataSource) {
     //if item satisfies certain conditions
     myAC.addItem(item);
    }
    view.myDataProvider = myAC;
   }

  }
}
seq2.png


Every time the data source is updated, the handler is called and the collection is filtered. It is convenient that the responder updates the entire collection at once and not adding items one by one, because the handler would be called every time. To stop watching the data source you can call the unwatch() function on the changeWancher instance in the ViewHelper.
This is only one of the possible solutions we can use thanks to the flexibility of data binding.

August 7, 2007

Creating an ObjectManager for improving the Flex interaction with Ajax or Javascript - 2nd part

In my previous post I have illustrated the creation of a simple object manager to make a javascript application correctly dialog with a Flex movie. That is a simple and well functioning solution, however it is not suitable for a more complex context, when it is necessary, for instance, to use several Flex or Javascript/Ajax applications.

What is the right choice in such a situation? The solution often depends more on the developer's creativity than on the possibilities offered by the technology in use.

Let's think, for example, to a comparable situation in actual life: one or more people try to contact the same person that is not available at that moment. If the communication were not much important, each of them could simply try later on, with the hope to find the person available (previous solution), although in the meantime others might anticipate his/her call. What if the communication were extremely important, and risks to arrive too late (after our competitors' communication, for instance)? In order to avoid that possibility and all the related consequences, a voice mail (or a simple answering machine) could be used, as well as, at a later stage, a personal secretary could be hired. The messages will be recorded in their incoming order (for example using a queue or a single instance if we need only the last message), and as soon as the address is available again he/she will listen to the recorded messages or will be informed about them by his/her secretary. We shall now examine how to implement the easiest case, taking again as an example the disabilitation of the Flex application:

- We create a JS class named ObjectManager, it will represent our answering machine. We also create an empty constructor, in this case we shall not use status variables related to the Manager:

ObjectManager = function () {

}

If necessary we could insert variables such as this.available into the object in order to indicate its availability or to initialize global variables.

The only method which is necessary for the object manager's functioning is AddObject. With this function we'll have the possibility to add the desired object (e.g. a Flex movie) to the manager class:

ObjectManager.prototype.AddObject = function (objectName) {

                if(eval('this.' + objectName +' == null')) {

                               eval('this.' + objectName + ' = new Object()');

                               eval('this.' + objectName + '.setStatus = null');

                               eval('this.' + objectName + '.enabled = 1'); //Default status value

                               return true;

                }

                else

                               return false; //object already registered

}

In this way, in the object manager will be created a simple object that we shall use to keep all the information which are necessary to guarantee the proper functioning of the application. Every object created in the object manager is directly linked to the object we want to control through the use of a unique string which represents it. For this reason it is necessary to use the function eval(string), as in the object manager we will not have direct reference to the objects to control.

September 9, 2007

An open source alternative to Adobe LiveCycle Data Services: Granite Data Services

Adobe LiveCycle Data Services ES, formerly called Flex Data Services (FDS), provides data services such as remoting, data push, publish and subscribe for Flex applications. With LCDS you can integrate flex with J2EE infrastructures and a previuos post on our blog shows an example: LiveCycle Data Services and Hibernate integration in Flex RIA applications.
There are a lot of open source projects around flex, flash and AMF, and, on java side, GraniteDS is one of the most promising.
It's developed under the LGPL and proposes itself as an alternative to Adobe® LiveCycle® (Flex™ 2) Data Services for J2EE application servers.
GDS is still in an early development phase, with a 0.3 version released on july 30, while, at the time of writing, the 0.4 one is in a release candidate state; despite this, it's rather stable and you can safely test it in non critical production environment as its home page suggests.
Here they are the features already implemented and the planned ones; this list is continuously updated


  • Full AMF3 support. See GDS AMF3 documentation.

  • EJB3 services with transparent externalization mechanism and lazy initialized ActionScript 3 beans (Entity Beans / Hibernate). See EJB3 Services and Externalizers and Lazy Initialization.
  • EJB3 Entity Bean to ActionScript 3 classes code generator. See AS3 Generation.

  • Spring services. See documentation on Spring Services.

  • POJO services (remote calls to simple Java classes that expose public methods). See Pojo Services.
  • (planned) Data push. A Comet-like implementation with AMF3 data polling over HTTP (event/listener based architecture).

  • (planned) Entity repository: a client side entity repository that ensures uniqueness (only one instance of each entity is present in the flash VM), weakness (only currently bound objects are kept in memory), and that acts as a services frontend (all server calls/events are managed by this central component). This will be loosely inspired by Cairngorm.

  • (planned) Seam integration: a reliable GDS/Seam integration with full scopes (at least conversation) support.
  • (planned) A set of Flex components suitable for complex data structures.

A key feature, implemented in version 0.3, is the support for setCredentials, setRemoteCredentials and logout methods of RemoteObject, more information in the release notes: http://www.graniteds.org/confluence/display/DOC03/Documentation+-+0.3

They provides various demos which you can you use importing them as new eclipse projects:


Moreover a live demo that shows Granite DS in action is available.

If you are interested in testing your LCDS application with Granite Data Services you have to make some changes according to the good documentation ready to help you; however you should check if all the features you need are implemented.
Granite DS is a promising project and the development is going on quite fast, but it still misses some important functionalities like messaging services and data push (planned feature) so by now LCDS is a must in a stable production enviroment, but i can suggest to keep an eye on GDS for the future.

October 11, 2007

Choosing the appropriate RIA Technology: my speech at the Oreilly Web 2.0 Conference

I am very glad to be part of one of the coolest and rich of contents conference made by Oreilly : Web 2.0 Summit .
I'll be present the following speech where I'll give you an overview of pros and cons of different techologies for RIAs development

web2_0_logo.gif
Choosing the final RIA path or Choosing the appropriate RIA Technology
Thursday, 8 November - 11:20 am–12:10 pm

Rich user interfaces and a satisfactory user experience are fundamental factors of Rich Internet Applications. Improved productivity, more effective work, time and cost reduction in the field of both operations and applications development are an important plus which deserves to be higlited when evaluating the suitability of tecnologies for applications projects. New development approaches have recently come to market : Flex, AIR, Flash, XUL, OpenLazlo, Silverlight, WPF, JavaFX. There are so many different technologies that it's easy to lose focus and misjudge goals when choosing a RIA platform. How to choose the best technology? What are their advantages? Which one is going to get the widest adoption? What can you do with them? This session guides you through the ecosystem of RIA's technologies, analyzing and comparing the benefits, features and disadvantages of each approach. Make the final RIA choice for your web applications.

Web 2.0 Expo in Berlin is the place to learn, network, and engage in the European Web 2.0 community.
Join your colleagues at this must-attend event and tap the power of Web 2.0 through:

* A comprehensive 5-track conference: Design and User Experience, Development and Web Operations, Fundamentals, Marketing and Community, and Strategy and Business Models
* Keynotes from thought leaders influencing the future of the web
* An Expo showcasing Web 2.0 services and technologies
* In-depth Workshops to get you up to speed
* Web2Open, an Open Space event for all delegates, where the audience become the speakers
* Great networking events designed to celebrate the Web 2.0 community

November 26, 2007

Choosing the appropriate RIA technology

While choosing the most appropriate RIA technology for a project, we should consider several factors:

1. the reach (% of users who will be able to get the RIA experience with their installed browser and plug-ins)
2. the availability of open source vs. commercial products
3. the company’s internal knowledge
4. the development time (time to market)
5. the community and support infrastructure

In addition to the above factors, that we can define as “supporting considerations” to the process of choosing the most appropriate RIA technology, we should consider a 6th factor which consists of the “intimate” suitability of a RIA technology to manage:

- Users interaction
- Rich media content

At Comtaste, we have defined the following chart to describe the positioning of 6 different RIA technologies respect the 2 above mentioned parameters (each measured in terms of several features): Ajax, Adobe Flex, Java FX, Lazlo, Microsoft Silverlight 1.1 and XUL .

The chart has been named “the RIA domain” because it represents, like for a mathematical function, the area within which an application can be defined as a Rich Internet Application. It corresponds to our personal feeling and experience as RIA developers.

RIA%20technologies%20positioning.JPG

This chart has been included in the slides presented by Marco Casario at the Web 2.0 Expo of Berlin. The complete set of those slides can be found here.

December 13, 2007

Adobe announces open source BlazeDS and the AMF data binary specification release

Adobe has just announced the BlazeDS beta release. On Adobe Labs today we can read that "BlazeDS is the server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Adobe® Flex™ and Adobe AIR™ applications for more responsive rich Internet application (RIA) experiences."

As a matter of fact, BlazeDS is an open source part of LiveCycle Data Services, while the complete Live Cycle suite will still be closed source and subject to Adobe’s Licensing policy.

The source code will be available for download in early 2008 (http://labs.adobe.com/technologies/blazeds/).

Adobe has also published AMF binary data protocol specification, on which the BlazeDS remoting implementation is based.

BlazeDS introduces the concept of HTTP streaming, that enables clients to maintain persistent connections with backend servers. HTTP streaming will practically allow the same data push functionality that is available with the LiveCycle Data Services, with the difference that the streaming will not use the RTMP messaging channel.

Among the news, Adobe will offer Adobe LiveCycle Data Services, Community Edition, a subscription offering that includes certified builds of BlazeDS, access to Adobe enterprise support resources and additional benefits, such as product warranty and infringement indemnity, as well as additional developer support.

After the release of the Flex SDK open source, Adobe gives further signals of willingness to pursue the construction of a stronger and wider developers' community.

February 9, 2008

The new BlazeDS JMSAdapter allows to pass connection-level credentials to JMS

I want to point out for the readers of this blog (mainly Java, Flex and Livecycle developers) an article I published on my personal blog :
Passing connection-level credentials to the JMSAdapter of BlazeDS
One of the limit if the Messaging Services of Livecycle Data Services is the inability to define a username and password in the configuration file to pass them to the JMS.
I discovered that in BlazeDS there is a new JMSAdapter that allows you to set the connection-level credentials passing the username and password.
The new connection-credentials XML node sets the the username and password used while creating the JMS connection.As the documentation said, use only if JMS connection level authentication is being used :



...

Topic
javax.jms.TextMessage
jms/flex/TopicConnectionFactory

jms/topic/flex/simpletopic

NON_PERSISTENT
DEFAULT_PRIORITY
"true"
AUTO_ACKNOWLEDGE

1

For many developers this new features supported by the JMSAdapter could be very appreciated and could solve problems in many different scenarios where the authentication is required in JMS.

Read the full Passing connection-level credentials to the JMSAdapter of BlazeDS article.

March 27, 2008

Comtaste launches new Adobe Flex 3 and Adobe AIR training courses in New York City, London and Milan

Comtaste has just launched its new training courses on Adobe Flex3 and AIR for late spring-early summer 2008.

First courses to be scheduled are:

"Flex 3 and Flex Builder 3: Developing Rich Internet Applications with the new Flex 3 SDKs" (Milan and London 26-29 May, NYC-Manhattan 2-5 June)

"Developing desktop applications with Adobe AIR, Ajax and Flex" (Milan 14-17 April, NYC-Manhattan 9-12 June, London 23-26 June).

Our educational proposal, designed and set up by Flex expert Marco Casario, is mainly the result of our strong experience in real world enterprise projects.

Our courses reflect our clients' training needs that our consultants have encountered in the day by day running of enterprise-class projects, where Flex and AIR are also connected to backend applications under robust and rigid JEE architectures or other server side technologies.

Training programs and other details on company's website www.comtaste.com/en/training.htm

April 30, 2008

Measuring the ROI of choosing Flex for Enterprise RIAs

The ROI index is a synthetic yet meaningful parameter used to express the benefit of making a project, as well as the benefit of making a certain choice related to a project, for example the technology to be used.

During my speech at the recent 360Flex Conference in Milan I presented the benefits achieved as a consequence of adopting Flex to re-design an enterprise application.

After an overview concerning the practical methods that can be used to evaluate the benefits and to calculate the Return On Investment (ROI), I presented a real-world case of an application for banking operations.

In that case, the benefit was measured in terms of the time saved to execute an ordinary operation (cashing a check) by using the Flex re-designed application respect the time that was formerly necessary to execute the same operation by using a "common" Oracle form-based application (simple html using the "traditional" logic of 1 click=1 page).

A tipically physical kind of measurement (time saved) was then translated into an economic parameter by valueing the time by the standard hourly wage of the staff involved in the operations of that kind.

The final passage was the calculation of the ROI formula.

The important and evident result was that the use of Flex contributed to leverage the ROI formula numerator (return) and to decrease its denominator (investment), for a double action of increment on the final result.

The slides of that speech can be found on SlideShare

May 12, 2008

Improve the ObjectHandles library with a smoother resizing movement

A very common UI element found in many applications are those little square handles around an on-screen object that allow you to move & resize it. To do this you can use the great ObjectHandles library.

ObjectHandles (http://osflash.org/projects/objecthandles) is a library to allow a user to move and resize UI elements in a Flex based application.
It provides drag handles around controls that users can manipulate with their mouse. Any Flex component can be placed within an ObjectHandles container to quickly allow you to add functionality.

It behaves as a container object where you can put any other flex components and use its resizeable functionalities.

Features of the ObjectHandles library:

* Move & Resize Functionality for any flex component
* Ability to limit movement and/or resizing in both vertical and horizontal directions
* Ability to limit movement and/or resizing along an anchor
* Simple 1-file (.swc) install
* Mouse cursors change when over different handles
* Graphical handle support
* Aspect ratio support
* Initial rotatation support has been added

ObjectHandles is a very cool library for your project when you want to implement moving & resizing any kind of flex object.

Example usage:

In the example below you'll see two buttons in a vbox that can be moved together. This is the mxml to achieve that:

<oh:ObjectHandles x="10" y="158" width="107" height="108"
minHeight="30" minWidth="30">
<mx:VBox borderStyle="none" top="0" left="0" right="0" bottom="0">
<mx:Button width="100%" height="50%" />
<mx:Button width="100%" height="50%" />
</mx:VBox>
</oh:ObjectHandles>

Or if you want an Actionscript example:

Here's an example to dynamically load an image into an ObjectHandle and allow resize movements:

protected function init() : void
{
var oh:ObjectHandles = new ObjectHandles();
oh.height = 50;
oh.width = 50;

var image:Image = new Image();
image.source = "snowflake.png";
image.percentHeight = 100;
image.percentWidth = 100;
image.maintainAspectRatio = false;

oh.addChild(image);
oh.allowRotate = false;

genericExamples.addChild(oh); // replace genericExamples with a canvas in your application
}

Improving the experience of the ObjectHandles library

When you drag or resize an object from right to left or from up to down everything works great.

But if you to resize the object back (from right to left) you'll see that the inside object will cause a strange flickering.

To prevent this we can use the "Flex Move Effect" and "Flex Resize Effect" instide of change programmaticaly width and height and x and y.

How it actually works:

Inside the ObjectHandles.as Actionscript 3 class, you can find the protected function onMouseMove(event:MouseEvent) : void.
This is the function that moves and resizes UI elements in a Flex based application. Find the following line inside the ObjectHandles.as:

if( wasMoved || wasResized )
{
applyConstraints(desiredPos,desiredSize);
x = desiredPos.x;
y = desiredPos.y
width = desiredSize.x;
height = desiredSize.y;
}

The applyConstraints() method simply applies restrictions to your objects like xAnchor, minium size, etc. The other four lines simply set the x,y coordinates and the width and height properties of the Flex object.

Now let's change this four lines to prevent the strange flicker bug that affects the object :

if( wasMoved || wasResized )
{
applyConstraints(desiredPos,desiredSize);

if(moveEffect.isPlaying){
moveEffect.end();
}
moveEffect = new Move();
moveEffect.target = this;
moveEffect.duration = 1;
moveEffect.xTo = desiredPos.x;
moveEffect.yTo = desiredPos.y;
moveEffect.play();

if(resizeEffect.isPlaying){
resizeEffect.end();
}
resizeEffect = new Resize();
resizeEffect.target = this;
resizeEffect.duration = 1;
resizeEffect.heightTo = desiredSize.y;
resizeEffect.widthTo = desiredSize.x;
resizeEffect.play();
}

It replaces the brutal property changing of the widget with a smoothness move and resize effect provided by Flex.

In the next post we will see how to create a snap to grid and a snap to line effect.

Conclusion and references:


ObjectHandles google code home
Class Move
Class Resize

May 26, 2008

Google Maps API for Flex and Flash: some tips and notes

Finally the official version of Google Maps for Flash is arrived.
Google has just released the Actionscript API that provides map functionalities to web applications in a way really similar to the Javascript version.
You can follow the instructions in the Setup or Tutorial pages on Google Code to easily build your web map application.
Here is a sample application based on data from Yubuk (click on the image):
GoogleMapsFlex

And now some hints that can be useful when creating your first Flex application with Google Maps:

1) Remember to add the .swc library provided by Google in their SDK in your compiler options. If you are using Flex Builder you can do that simply going in the project properties, under Flex Build Path, then Library Path and click Add SWC. Otherwise, if you like to use the command line, you can use the -library-path command as explained in the Google tutorial.

2) Pay attention to the events: you can't use the standard Flex events but you need that ones provided by the Google SDK, such as MapMouseEvent.CLICK.

3) Custom markers have a bug in the version 1.3. To avoid this bug there's a workaround in Google Code. The example has a small error in the marker event listener, the event should be MapMouseEvent.CLICK (as explained above).

I think that Google made a great work porting their Google Maps API to Flash. It is still incomplete but it's already possible to see the huge potential provided by the cooperation between Google Maps and Flex. I'm sure that in the near future there will be many interesting RIA based on these technologies.

July 8, 2008

Using the Loader class to load and set dimensions of an image from the remote server in Flex 3

Working and creating images in Flex could not be as easy as it looks. When you load an image loaded from the remote server you will tipicaly receive a ByteArray data. The ByteArray image doesn't contain any information such as the width and height of that data. Moreover you must know when the entire bytearray it's been fully loaded on the client.

To do this we need to load the bytearray with the Loader Class.
So we need to extend an mx.control.Image Class and add the loader information:

private var _loader:Loader = new Loader();

Now wee need to implement a method to load the bytes:

public function loadBytes(bytes:ByteArray, context:LoaderContext = null):void
{
_loader.loadBytes(bytes, context);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onBytesLoaded);
}

This method will load the byte array image and add the listener to know when is ready.

After the event.complete handler will bring up with the loader information:

private function onBytesLoaded( e:Event ):void
{
source = _loader.content;
width = _loader.contentLoaderInfo.width;
height = _loader.contentLoaderInfo.height;
removeChild(_loader);
}

You can see that now we can set the source for the image and than set the correct width and height getting the information from the _loader.contentLoaderInfo.

Finally we remove the loader.
Here you can find the complete source for the ByteArrayImage Class:

The Class

package
{
import flash.display.Loader;
import flash.events.Event;
import flash.system.LoaderContext;
import flash.utils.ByteArray;

import mx.controls.Image;

public class ByteArrayImage extends mx.controls.Image
{
private var _loader:Loader = new Loader();

public function ByteArrayImage()
{
}

override protected function createChildren():void
{
_loader.visible = false;
addChild(_loader);
}

public function loadBytes(bytes:ByteArray, context:LoaderContext = null):void
{
_loader.loadBytes(bytes, context);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onBytesLoaded);
}

private function onBytesLoaded( e:Event ):void
{
source = _loader.content;
width = _loader.contentLoaderInfo.width;
height = _loader.contentLoaderInfo.height;
removeChild(_loader);
}
}
}

A simple implementation:

import flash.image.JPEG;
import flash.image.PNG32;
myJPG:ByteArray = new JPEG( bitmapData , 300, 300, 80 );
myPNG:ByteArray = new PNG32( bitmapData , 1500, 1260 );

myByteImage:ByteArrayImage = new ByteArrayImage();
myByteImage.loadBytes( myJPG or myPNG );

Reference:
ByteArray LiveDocs
Loader LiveDocs

About Flex

This page contains an archive of all entries posted to Comtaste Consulting | Enterprise RIA consulting and development in the Flex category. They are listed from oldest to newest.

Flash Player is the previous category.

Flex Data Services is the next category.

Many more can be found on the main index page or by looking through the archives.

Powered by
Movable Type 3.33