12.08.2009
Image capture in Flex
Flex provides a way to capture the visible state of Flex components which is useful for dynamic effects - capture an image and use it for the slide/fade/etc rather than the actual components. See ImageSnapshot.captureBitmapData()
8.31.2009
Keyboard support in custom components
It turns out that if you extend UIComponent to create a custom component you will not receive keyboard events unless you also implement IFocusManagerComponent (all method impls are already provided in UIComponent).
7.29.2009
Using mx_internal
When you need to use mx_internal follow this approach:
1) import mx.core.mx_internal;
2) use namespace mx_internal (after imports and before class definition)
1) import mx.core.mx_internal;
2) use namespace mx_internal (after imports and before class definition)
3.19.2009
Flash Player Internals Discussion
Here is an excellent post discussing flash player internals, ActionScript compiler and execution speed optimization.
3.09.2009
Flex Threading
Although Flex does not provide a threading API there are still some options for executing logic in the background:
1. Network access runs in a separate thread, it just happens to be outside our direct control.
2. I heard a mention that PixelBender provides a way to use threads by placing code into a PixelBender workflow (more investigation is needed here). Try this link. Here is an article going into depth about PixelBender and explaining how it does multi-threading.
3. A new project ender-lib simulates threads in ActionScript, making it easy to break up your code into bits that can be processed without freezing the UI.
1. Network access runs in a separate thread, it just happens to be outside our direct control.
2. I heard a mention that PixelBender provides a way to use threads by placing code into a PixelBender workflow (more investigation is needed here). Try this link. Here is an article going into depth about PixelBender and explaining how it does multi-threading.
3. A new project ender-lib simulates threads in ActionScript, making it easy to break up your code into bits that can be processed without freezing the UI.
2.04.2009
Dynamic Infographic
A Flex app that acts as a dynamic infographic. Well designed and very effective.
http://synoptic.weaintplastic.com/
http://synoptic.weaintplastic.com/
10.16.2008
Flash/Flex Bugs
Here are some important bugs to keep in mind:
SDK-14669 Modules don't load properly
FP-201 : file uploads over SSL are broken for all browsers except IE
FP-40 : unicode text input is broken on Linux Flash Player - internationalization problem
FP-444 : need ability to globally catch runtime errors - technically a feature request, but a very important feature
FP-37 / FP-166 : it appears that Flash Player is unreliable on some 64-bit Linux platforms - need more investigation here
FP-129 : it is difficult to fully unload a Flash module (releasing all its resources). See these related articles: one, two. There seem to be some workarounds in FP10.
FP-226 : seems that File uploads don't work when connecting over SSL to self-signed server
SDK-13740 : another feature request - HTML rendering is VERY limited in Flex
SDK-14669 Modules don't load properly
FP-201 : file uploads over SSL are broken for all browsers except IE
FP-40 : unicode text input is broken on Linux Flash Player - internationalization problem
FP-444 : need ability to globally catch runtime errors - technically a feature request, but a very important feature
FP-37 / FP-166 : it appears that Flash Player is unreliable on some 64-bit Linux platforms - need more investigation here
FP-129 : it is difficult to fully unload a Flash module (releasing all its resources). See these related articles: one, two. There seem to be some workarounds in FP10.
FP-226 : seems that File uploads don't work when connecting over SSL to self-signed server
SDK-13740 : another feature request - HTML rendering is VERY limited in Flex
10.15.2008
Updated SWF embedding
A new updated way to embed Flash/Flex content in web pages has been released: SWFObject2.
A useful starting place is this article.
A useful starting place is this article.
Flash Player 10
We now have a release of Flash Player 10. Here are some brief notes and links:
Flash Player 10 Downloads
Administration Guide
New Features
- text improvements including vertical text, RTL text, customization of device fonts (anti-aliasing)
- updated 2D drawing API
- new Vector class: type-specific collection, faster than Array
- apps are now able to access client-side files
- graphics performance improvements
- it is now possible to read from the clipboard
- pixel bender for creating custom effects
Detailed API Changes
Flash Player 10 Downloads
Administration Guide
New Features
- text improvements including vertical text, RTL text, customization of device fonts (anti-aliasing)
- updated 2D drawing API
- new Vector class: type-specific collection, faster than Array
- apps are now able to access client-side files
- graphics performance improvements
- it is now possible to read from the clipboard
- pixel bender for creating custom effects
Detailed API Changes
10.10.2008
Flex Applications
A brief collection of nice Flex applications and demos:
OECD Statistics
cynergytv.com
www.lovelycharts.com/
www.adobe.com/acom/buzzword/
blist.com
NASDAQ Market Replay
coghead.com
empressr.com
OECD Statistics
cynergytv.com
www.lovelycharts.com/
www.adobe.com/acom/buzzword/
blist.com
NASDAQ Market Replay
coghead.com
empressr.com
MVC Frameworks
A variety of MVC frameworks and approaches are available for Flex applications. An independent firm has published a useful review of several of these frameworks.
Cairngorm
This is probably the first and most widely-used MVC framework for Flex. The official version had grown somewhat stale but users have been customizing it and Adobe has recently setup an open-source project where development seems to be progressing.
Most reviews seem to be pretty critical of Cairngorm, primarily for these reasons:
- overuse of Singleton pattern
- no support for module-based apps
- large amount of boilerplate overhead
Here are some useful Cairngorm links:
http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html
http://www.cairngormdocs.org/.
flexcairngorm project on google code with some extensions
PureMVC
This is the most talked about alternative to Cairngorm. It seems to be pretty sophisticated and well-developed, offering solutions to two of the Cairngorm criticisms - PureMVC supports module-based apps and does not rely heavily on Singletons.
On the other hand it still requires a fair bit of code overhead and since it attempts to be a cross-language architecture it does not take advantage of several Flex-specific features (PureMVC replaces the standard Flex event architecture with its own approach for example).
Here are some useful PureMVC links:
PureMVC Multicore
http://www.websector.de/blog/2007/12/25/10-tips-for-working-with-puremvc/
http://www.dehats.com/drupal/?q=node/26
http://hubflanger.com/building-a-flash-site-using-puremvc/
PureMVC Forum
http://flashenabledblog.com/2008/07/22/tutorials-puremvc-roundup/
http://www.websector.de/blog/2008/06/21/a-basic-puremvc-multicore-as3-example-using-pipes-utility-and-modules/
http://www.nutrixinteractive.com/blog/?p=136
Mate
Mate is a lighter-weight alternative to Cairngorm and PureMVC which is based primarily on the MXML language instead of ActionScript (may be a good or bad thing depending on your preferences). Here is a good overview article.
MVCS
MVCS is not really a framework but a design or approach to architecting Flex applications to achieve an MVC structure. The design is very good - flexible, lightweight and easy to use. I would recommend MVCS (or a similar approach) above the other currently available frameworks.
Another useful article: http://www.joeberkovitz.com/blog/reviewtube/
Cairngorm
This is probably the first and most widely-used MVC framework for Flex. The official version had grown somewhat stale but users have been customizing it and Adobe has recently setup an open-source project where development seems to be progressing.
Most reviews seem to be pretty critical of Cairngorm, primarily for these reasons:
- overuse of Singleton pattern
- no support for module-based apps
- large amount of boilerplate overhead
Here are some useful Cairngorm links:
http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html
http://www.cairngormdocs.org/.
flexcairngorm project on google code with some extensions
PureMVC
This is the most talked about alternative to Cairngorm. It seems to be pretty sophisticated and well-developed, offering solutions to two of the Cairngorm criticisms - PureMVC supports module-based apps and does not rely heavily on Singletons.
On the other hand it still requires a fair bit of code overhead and since it attempts to be a cross-language architecture it does not take advantage of several Flex-specific features (PureMVC replaces the standard Flex event architecture with its own approach for example).
Here are some useful PureMVC links:
PureMVC Multicore
http://www.websector.de/blog/2007/12/25/10-tips-for-working-with-puremvc/
http://www.dehats.com/drupal/?q=node/26
http://hubflanger.com/building-a-flash-site-using-puremvc/
PureMVC Forum
http://flashenabledblog.com/2008/07/22/tutorials-puremvc-roundup/
http://www.websector.de/blog/2008/06/21/a-basic-puremvc-multicore-as3-example-using-pipes-utility-and-modules/
http://www.nutrixinteractive.com/blog/?p=136
Mate
Mate is a lighter-weight alternative to Cairngorm and PureMVC which is based primarily on the MXML language instead of ActionScript (may be a good or bad thing depending on your preferences). Here is a good overview article.
MVCS
MVCS is not really a framework but a design or approach to architecting Flex applications to achieve an MVC structure. The design is very good - flexible, lightweight and easy to use. I would recommend MVCS (or a similar approach) above the other currently available frameworks.
Another useful article: http://www.joeberkovitz.com/blog/reviewtube/
10.08.2008
Flex Architecture
After further thought it seems that the emphasis on the MXML / ActionScript / CSS style architecture is based on thin client web development: document structure defined in MXML (analogous to HTML), visual style in CSS, client-side logic in ActionScript (analogous to JavaScript).
My experience with fat client development in Java/Swing causes me to lean towards a pure ActionScript approach instead of the more common MXML / ActionScript blend. I typically design dynamic interfaces and prefer the flexibility that ActionScript provides for the UI implementation.
My experience with fat client development in Java/Swing causes me to lean towards a pure ActionScript approach instead of the more common MXML / ActionScript blend. I typically design dynamic interfaces and prefer the flexibility that ActionScript provides for the UI implementation.
Flex Libraries
BirdEye - information visualization tools
AS3CoreLib - library of ActionScript code for JSON serialization, String/Number/Date enhancements, hashing, etc.
ModestMaps - provides an interface for working with maps from several different sources (Yahoo, Google, Microsoft, etc).
Efflex - custom Flex effects
Flare - data vizualization library
FlexLib - UI component library (new UI components)
This one looks like a useful collection of components
OpenFlux - replacement for some Flex UI components
It seems that the idea here is to create more flexible UI components, using a component-level MVC architecture. While there is certainly room for improvement on the standard Flex components in order to be effective a library must be rock-solid and support all expected features. I don't think OpenFlux is there yet.
Tweener - supports animation by helping you move items around
This looks useful as well
Degrafa - declarative graphics
Not sure why we need support for 2D graphics in MXML. It's something like translating the Bible into pig-latin. Always use the most powerful and effective language.
AS3CoreLib - library of ActionScript code for JSON serialization, String/Number/Date enhancements, hashing, etc.
ModestMaps - provides an interface for working with maps from several different sources (Yahoo, Google, Microsoft, etc).
Efflex - custom Flex effects
Flare - data vizualization library
FlexLib - UI component library (new UI components)
This one looks like a useful collection of components
OpenFlux - replacement for some Flex UI components
It seems that the idea here is to create more flexible UI components, using a component-level MVC architecture. While there is certainly room for improvement on the standard Flex components in order to be effective a library must be rock-solid and support all expected features. I don't think OpenFlux is there yet.
Tweener - supports animation by helping you move items around
This looks useful as well
Degrafa - declarative graphics
Not sure why we need support for 2D graphics in MXML. It's something like translating the Bible into pig-latin. Always use the most powerful and effective language.
Layout Ideas
Some innovative ideas for layout management: http://www.somerandomdude.net/blog/flash/actionscript-3-layout-organizers-source-code/
10.03.2008
Local Persistence
I finally found out how to save preferences, do basic logging, etc on the client side: use SharedObject.
9.24.2008
Code Recommendations
A few recommendations after developing my first Flex app:
1) Use "as" instead of "()" to cast objects. This provides consistent syntax for all casting (Date and Array require "as") and cannot be misinterpreted as a constructor call.
2) Use a "prop" suffix instead of "_" prefix for properties. This reduces the visual noise and doesn't resemble bad Java/C++ practices.
3) Use properties for members that are externally accessible, use simple members for internal access. Use the actual property name (not the internal name with suffix) when referenced within the class.
4) Always provide a default constructor. If more construction options are needed provide factory methods.
5) Avoid MXML as much as possible. It makes the code messy and provides little added benefit. It also forces the developer to constantly make decisions about whether to implement features in MXML and ActionScript and forces the developer to learn how to implement in both languages. Instead provide a standard container with helper methods that make it easy to create pure ActionScript components.
6) ActionScript is very flexible and has many interesting nooks and crannies. To simplify development some features should be avoided if possible. These include: dynamic classes, definitions outside classes or interfaces, untyped properties, namespaces in ActionScript. Also always compile using strict dialect.
1) Use "as" instead of "()" to cast objects. This provides consistent syntax for all casting (Date and Array require "as") and cannot be misinterpreted as a constructor call.
2) Use a "prop" suffix instead of "_" prefix for properties. This reduces the visual noise and doesn't resemble bad Java/C++ practices.
3) Use properties for members that are externally accessible, use simple members for internal access. Use the actual property name (not the internal name with suffix) when referenced within the class.
4) Always provide a default constructor. If more construction options are needed provide factory methods.
5) Avoid MXML as much as possible. It makes the code messy and provides little added benefit. It also forces the developer to constantly make decisions about whether to implement features in MXML and ActionScript and forces the developer to learn how to implement in both languages. Instead provide a standard container with helper methods that make it easy to create pure ActionScript components.
6) ActionScript is very flexible and has many interesting nooks and crannies. To simplify development some features should be avoided if possible. These include: dynamic classes, definitions outside classes or interfaces, untyped properties, namespaces in ActionScript. Also always compile using strict dialect.
9.19.2008
All-ActionScript application
It may be desirable to implement a Flex application using 100% ActionScript instead of splitting the code between ActionScript and MXML. Here's a simple way to bootstrap such an application:
App.mxml
AppImpl.as
App.mxml
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" applicationComplete="LayoutTestImpl.main()"/>
AppImpl.as
package {
import mx.controls.*;
import mx.core.*;
public class AppImpl {
public static function main():void {
new AppImpl().startApp();
}
public function startApp():void {
var helloLabel:Label = new Label();
helloLabel.text = "Hello World";
var app:Application = Application.application as Application;
app.layout = "vertical";
app.addChild(helloLabel);
}
}
}
9.11.2008
9.02.2008
7.31.2008
BlazeDS Remote Objects
There are several things to keep in mind when using BlazeDS Remote Objects to access Java code:
1. Java data classes must have a default constructor and both set and get methods for each attribute.
2. If a Java service provides overloaded functions with the same number of arguments BlazeDS will call the first function (you may get class cast exceptions if you intend to call the second).
3. ActionScript classes must be created and aliases set for the entire class hierarchy that is referenced by parameters in the Java methods.
4. A bug exists preventing an ActionScript collection of Strings from properly deserializing into a Java collection of enums.
5. A bug exists preventing a Java map with keys that are not Strings from properly deserializing into ActionScript.
6. Be careful when using Java long because it deserializes into ActionScript Number which uses only 53 bits to store the integer portion of a floating point number.
7. Java exceptions are only included in the ActionScript FaultEvent if the Java method declares that it throws exceptions.
1. Java data classes must have a default constructor and both set and get methods for each attribute.
2. If a Java service provides overloaded functions with the same number of arguments BlazeDS will call the first function (you may get class cast exceptions if you intend to call the second).
3. ActionScript classes must be created and aliases set for the entire class hierarchy that is referenced by parameters in the Java methods.
4. A bug exists preventing an ActionScript collection of Strings from properly deserializing into a Java collection of enums.
5. A bug exists preventing a Java map with keys that are not Strings from properly deserializing into ActionScript.
6. Be careful when using Java long because it deserializes into ActionScript Number which uses only 53 bits to store the integer portion of a floating point number.
7. Java exceptions are only included in the ActionScript FaultEvent if the Java method declares that it throws exceptions.
Subscribe to:
Posts (Atom)