knowledge.lapasa.net » Flex 2 Notes: World of Buttons

Read this interesting and simple tutorials on when to use buttons and how to do that.

[ Read more… ]

cayambe.com » TreeGrid Version 2

The second version of the TreeGrid component is done. It is working much better thanks to comments from Matt and Jose. I was able to resolve all of the issues I was aware of except the hard coded reference to “product”. I was even able to get recursion working.

[ Read more… ]

PHP Proxy for Flash Cross-Domain Security problems

Posting to a blog from flex [ Read more ]

Alert.show() behavour in flex

The other day, my colleague (Ajit Parthan) was telling me about a wierd behavoiur he had noticed with the Alert.show() in flex. In flex, when you throw an alert, the code execution doesnt halt.

I have myself noticed many times that when you give out multiple alerts, each alert popups one over the other. Each alert doesnt wait for the user to manually dispose it before proceeding further with the code. Is that wierd? Somehow, it never ‘clicked’ to me that this could be problem :). But, now I relealized that it could be a slight inconvenience. That is, it requires the developer to do things a bit differently than he is used to in other languages.

In javascript or java, when the user alerts in the code, the code execution stops after popping up the alert. And when the user clicks OK, then the execution continues. Since apparently this was not happening in Flex, Ajit went looking around for the solution and this is what he found.

It isn’t a bug; it’s due to the way that the Flash Player works. The Player isn’t threaded and doesn’t have public APIs for processing its event queue. Alert.show() must return as soon as the Alert is shown — not when the user dismisses it — so that the Player can handle the user’s mouse and keyboard events while the Alert is up.

This is similar to what happens when you use APIs that load information over the network… they return immediately, and you get notified via an event when the data arrives.

– Gordon Smith (in Flexcoders mailing list)

To handle this, you have to write a handler function to be executed if the user clicks OK, and pass it as an arguement to the Alert.show() method. For example, if you are trying to save some user info to the backend, and you would like the user to confirm the action.

alert("Are you sure?", "Confirmation", mx.controls.Alert.OK | mx.controls.Alert.CANCEL, setUserInfo);

In the code above, the setUserInfo function will be called if the user clicks on OK. For more details, check out here and here.

Beyond Styling

This is documented in the livedocs, but I also wanted to give some examples of how you can apply filters to components to further achieve your desired look-and-feel. Want a drop-shadow on a button or a label? Want your text to look chiseled, or maybe your combo-box looking nicely chiseled? What an inner-shadow on a text input? Or maybe you just wantd a an area that looks beveled, or inset. This is all possible with filters in flex, as shown in the image below.

[ Original Post | Download | Demo ]

Transition and tween explorer

Adobe Consulting:
This tool allows you to try out the various transition and tween effects offered in ActionScript 2.0 and then, when you’re happy with the way it looks, you can copy the code snippets into your own movies.

[ Original Post | Download ]

Context Menu Builder

A Flex Context builder – Here.