Wednesday, May 12, 2010

Adobe and Apple

In addition to being my two favorite technology companies they are also in quite the feud. It has been hard to watch two companies that I have so much respect for have such a hard time coming to terms. The because the iPod, iPhone, and iPad do not support the Flash Player and will not be allowed Steve Jobs posted his "Thoughts on Flash" to clarify his position. Jobs stated reasons including performance, multi touch support, and feature adoption as to why Flash would not be included. I don't think it is Apple choice to say that a developer can't use a tool or not. If Flash has some limits and developers want to use it anyway, we should be able to.

One point I am surprised I have not heard is that Apple is restricting Flash to grow the Objective-C community. The number of Objective-C developers that know how to write Mac apps has always been small, but since the iPhone those numbers have been growing rapidly. If developers that know Flash can port their exiting apps to the iPhone they would not need to learn Objective-C. To me that is the real reason Apple has been holding up a front against Flash. They want a large community of developers that know how to write Objective-C apps because those developers will also know how to write apps for OS X. Job says, "we want to provide the most advanced and innovative platform to our developers, and we want them to stand directly on the shoulders of this platform...". 

Kevin Lynch states in his rebuttal to Job's blog that Adobe is no longer going to work toward Flash support on the iPhone, iPod, or iPad and in turn is going to focus on the Android and other mobile devices.

Tuesday, May 4, 2010

Flex Databinding

If you have done Flex development you are probably no stranger to databinding. Data binding will update a property any time the bound property is modified. What it is updated with is another story. I will list various ways to use databinding beyond just mapping one value to a property.

One variable:
The variable can exist in the MXML or a class it inherits.
text="{total}"

Or it can be inside an object. If so Flex will detect changes to the value and assignments to any of the objects in the binding.
text="{model.total}"
text="{model.products.total}"

A variable and text:
The property is not limited to only a bound or non bound value. You can insert the binding into a constant.
text="Your total is: {total}"

Multipule variables and logic:
Slightly more advanced we can use more than one value in a binding. In the following example flex will fire the binding if either "a" or "b" is changed.
text="{a} + {b} = {a+b}"
visible="{a || b}"

Functions:
My favorite trick. If the logic is complicated, use data binding to call your function when the variables change. The function will be called any time the variables are changed and the result of that function will be applied to the property defined.
text="{getCustomMessage(itemCount,userName)}"