Spark Pains: is it worth it?

Something happened to the Spark model on the way from the design board to the implementation of the API.
Having spent significant time with skinning tab components with Flex 4 and spark, I am having some serious thoughts regarding actually using it in future projects. It simply is too much pain to use.

Here is my problem: they said the new components will be easier to use and reduce development time, but in reality spark gives less for more code. Hell, we could do much better with the old halo skins!

Let’s look at spark tab bar navigation as an example.
First task: set the gap between tabs and the tab button skin. You’d expect it done easily by simply setting a property or a style, but no – both are set by the dataGroup skin part of the TabBar component. Event more annoying – there is a ‘skinClass’ style selector for the tab button, but it cannot be set from CSS because it is overridden in the TabBar skin.
So instead of

 
    <tabBar id="bar1" gap="8"
                tabSkinClass="myTabSkin"/>

we would have to hack into the skin part, in something like:

    protected function onInit():void
    {
          var barLayout:ButtonBarHorizontalLayout = (bar1.skin as TabBarSkin).dataGroup.layout as ButtonBarHorizontalLayout;
          barLayout.gap = 8;
 
          // TODO: set the tab skin directly
    }

For anything more than that, you would be forced to write a new skin class for TabBar, whose only purpose is to set these two properties as hardcoded values, with no option to parametrize them as you would expect from a modern API.

And the same goes for most spark components, except maybe the containers.
Remember the good old days of mx components? you could achieve the same with the default skin, right out of the box (at least in most cases).

Sure, if you intend writing everything with custom skins that makes sense, but whenever you can do without skinning its simpler and faster. Not to mention the lack of many common styles in spark skins, so all the samples are intended for hardcoded values for colors, sizes, etc. – wouldn’t it be much more efficient to parametrize these skins so they could actually be reused?

Again, I hate to complain, and perhaps I am wrong about this, but it just feels incomplete. I’d love to hear any suggestions or opinions.

, ,

2 Responses to Spark Pains: is it worth it?

  1. Mr. Ed July 17, 2010 at 1:06 am #

    You can add a gap (i.e. 10) between the tabs (buttons) of TabBar by doing this:

    <s:TabBar id=”bar1″ dataProvider=”{mydata}”>
    <s:layout>
    <s:ButtonBarHorizontalLayout gap=”10″ />
    </s:layout>
    </s:TabBar>

Trackbacks/Pingbacks

  1. Flex 4.5 - A Hero's welcome | The FlexWiz Blog - January 31, 2011

    […] (Spark pains) I expressed my disappointment with Spark’s lack of functionality versus the Flex 3 mx […]