2 Things about Flex… August 23, 2009

We’ve been developing a visually complex Flex app in the last couple of weeks or so. Its not complex from an ‘enterprisy’ type view, but it does have to achieve a few things visually which have been a challenge. I’ve really enjoyed developing in Flex so far, but have found a few issues which I didn’t expect to find in such a well presented set of development tools. It’s almost as if, just as I’m moving forward, someone yanks the carpet out from under me…

Flex comes with a number of pre-built container components… things like ‘Canvas’ and ‘HorizontalList’. These containers are the basic building blocks of your app. Each one is designed to be used in different situations. The HorizontalList is suited to a series of items, presented horizontally. Since it is commonly bound to an Array or ArrayCollection object, it often has more items in it than can be displayed at any one time. So you have a scroll bar… you also have the ability to scroll the list along by creating a handler for the click event and listening out for a click and firing off a ’scrollToIndex’ function, which the name suggests, scrolls you to the relevant item. Thats great, except that the scrolling isn’t your gentle glide to the next item. Its just sort of yanks it over. My application calls for a little more finesse… some gentle scrolling. Impossible. Or so it seems at first. You have to completely re-engineer the HorizontalList to accomodate smooth scrolling. Its a bit of a job, and others have done it before,  but its really one of those things you would expect to have built in. I implemented the HSmoothBox, and then found out that it only accomodates identically wide items if you’re loding them dynamically. Argh! Back to square one. Eventually I modified the HSmoothBox to accept a width parameter, and now I have smooth scrolling! As it turns out, smooth scrolling was left out of Flex 3 because the developers couldn’t put it in, in time… so here’s hoping its gets included soon…

The next frustrating issue I had, was that there appeared to be no discernable way to make a button’s background transparent, short of completely re-skinning it. This is a real annoyance, since every other element in Flex has an ‘alpha’ or ‘backgroundAlpha’ property. Such a simple little thing… and the solution entails jumping through multiple hoops and doing backstroke through a minefield.

I completely understand that there might be complex technical reasons behind why these features were not included, but really, software ought to fulfil the user’s expectations of what can be done. Every component has a property to make it’s background transparent… except the one you want to make transparent…

Leave a Reply