Categories
Programming

Flexing my programming muscles

After writing the python program to convert the data to xml format, I started out to make a flex program that could display it in a neat way, with the hope of ultimately adding dynamic filtering and charting to it as well. I settled on some tabs and no menubar, so far.

One thing is for sure – the Adobe help system is quite good. That, coupled with lots of examples found on other peoples websites helped me make a program that did a lot of what I wanted (more on the final product in a later post). Originally, I started out in absolute mode, laying down my elements to the pixel perfect, specifying x and y. However, you soon enter into the hell of overlapping content coupled with multiple scrollbars that is set in stone on the users computer screen.That’s not what I want.

In the end I went back to drawing out my User-Interface with a combination of HBox and Vboxes (boxes that arrange content respectively horizontally or vertically), and specifying percentages that each element could take of the screen estate. This has the added advantage that when a user has a wider screen than 1024 pixels (which is my start requirement), the graphical elements rearrange themselves quite well.

One of the things that has bothered me the most to adapt to is how strongly each Actionscript variable is ‘typed’ to it’s element base. I lost count of how many times Flex complained to me that I was coercing some poor ‘exemelly variable’ to accept data from another variable from another ‘exemelly list’ type, and that this just wasn’t allowed… For example, if you create an XML list variable, you can’t assign an XML object to it (or part of it). Well, you can, but it’s not simple and you need to program extra code.
[Please feel free to correct me if you know better ways of doing this, I’m still a newbie at this]

In Python you assign a variable something, and Python takes care of it, the so called loosely-coupled binding. When I assign variable X the number 5 and later on add the fifth element from an array and that’s a number or something like a number, Python will happely convert the content of the fifth array element to numerical and add it to the 5.

In Actionscript this is much, much more rigid, and it’s a big pain in the behind to figure out what I am doing wrong and trying umpteen versions of the code before finally, at 0:30 at night getting it to work and *understanding* why Flex was complaining and fixing it. I do get the hang of it though, but it’s a different, more rigourous way of thinking.

Once the code works however, I’m astonished how fast I can set up new graphical elements and set dataproviders to them – in general mxml is just plain fun, actionscript is fun-hard, and they both deliver something that I wish Python had – a genuinely easy way of creating user interfaces.

I’ll post some more about the progress I’m making with creating this application soonish.

(Visited 130 times, 1 visits today)

2 replies on “Flexing my programming muscles”

Leave a Reply to Timo Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.