Archive for the 'Flex & Flash' Category

Automatically focussing on the text field with Flash

nirav January 13th, 2006

One of the important usability lessons is to set the cursor focus on an appropriate control when the webpage is loaded. So you would set the focus to the username textfield on the login page by default. This is very easy to do in JavaScript. Not so cleanly in Flash.

We wanted to do this about two years ago. We used the Selection.setFocus() method to set focus on the input textfield. This worked only if the focus was on the Flash movie. So it wouldn’t work when the user loaded the page for the first time.

Found a solution to it today! Focus the Flash movie when the page loads!

Macromedia LiveDocs have a nice comment thread on this. And there is another interesting tutorial on Free Flash Tutorials.

Note that this trick works only in IE.

Flex Datagrid Editing

December 23rd, 2005

If somebody has a simple solution to this, do let me know!

My head is currently spinning trying to figure out how to make an editable datagrid in Flex 2 Alpha 1. All the examples of this show a datagrid, a collection of text boxes and a few buttons. Selecting an item in the DataGrid will bind the value with the TextInput. (Which happens via the cellEditor routine I believe). You change the value in Text box, and click Update and it goes to the DataGrid.

I don’t want such round trips. Can’t we simply do inline editing and update the dataProvider right there? And, how about sending this to the backend for an actual update? Flash’s RDBMSResolver was a great thing, is there anything like that on Flex yet?

If I write my on cellEndEdit event handler, I get some strange errors of 0 being out of bound.
RangeError: Index '0' specified is out of bounds
at mx.collections::ListCollectionView/getItemAt()
at mx.collections::ListCollectionView/
http://www.macromedia.com/2005/actionscript/flash/
proxy::getProperty()

I couldn’t find many answers to these questions, and am hoping I get something soon!

« Prev