undocumented AS2 -> AS3 migration notes: setPropertiesAt()

here’s another item missed in the Adobe Flex 2 migration doc:

list.setPropertiesAt() has gone away. What replaced it? Good question. Here’s another: What’s the best way to change the background colors of datagrid rows?

Well, there is more than one approach to this, but for my purposes I wanted to set the row colors based on some criteria of the row content (i.e. from the dataprovider). Since I was extending the DataGrid class anyway, I chose to override the drawRowBackgrounds() function (which is also overridden in DataGrid, btw).

undocumented AS2 -> AS3 Notes: Datagrid

Well, the datagrid class IS covered by the Flex migration doc, but there are some mistakes.

In AS2 there was an event on DataGrid, DataGrid.cellEdit (Broadcast when the cell value has changed).

There’s no cellBeginEdit or cellEndEdit although the migration doc lists these as AS2 events and then says they’ve been changed to itemEditBegin and itemEditEnd. What it should say is that cellEdit has been removed and replaced by these three events:
itemEditBegin
itemEditEnd
itemEditBeginning

For more details see the Flex 2 Language reference…

undocumented AS2 -> AS3 migration notes : contextMenu

For the past several months I’ve been working on migrating a huge application from Flex 1.5 to Flex 2.0 (now 2.0.1). While the migration document from Adobe was invaluable in the early stages, there were plenty of changes that weren’t documented therein. In retrospect I wish I had kept a list of all these issues, as it is they are scattered among my general notes. It would be nice to have a place to compile these notes with other developers who have also been doing migration projects – I would hope such an effort would be pioneered and encouraged by Adobe…

Anyway I thought I should start posting them as I come across them. Here’s one:

context menu:
In flex 1.5, to refer to the Application-level context menu, you used Application.application.menu while contextMenu referred to any other context menu.
In Flex 2 / AS3 the application level contextMenu is also referred to as:

Application.application.contextMenu

Custom context menus on nested components

What do you do if your application needs custom context menus for components that are not at the application level but rather are nested within other containers or components?

You can change the Application level context menu when an event (such as mouse over) is triggered from your nested component, and reset the Application menu on another event (such as mouse out).

According to the Flex documentation, “In Flex, only top-level components in the application can have context menus. For example, if a DataGrid control is a child of a TabNavigator or VBox container, the DataGrid control cannot have its own context menu.”

Below is a simple example that changes the Application level context menu when the user mouses over a button nested within an HBOX and resets the context menu when the user mouses off the button.

You can see the working example here and you can right-click on it to view the source.

OK, well this example worked great but as it turns out the documentation for AS3 on ContextMenu is actually WRONG, as someone was nice enough to point out on my Flex Cookbook Beta entry on this topic. To quote him,

“All DispalyObjects in Flex have a property called ‘contextMenu’ and you can set the context menu on any DisplayObject with this. The documentation is actually wrong. It doesn’t matter where in the display heirarchy the object is.”

For more on this topic see the Cookbook entry

Adobe brings Premiere back to the Mac

I just completed work on a short film project using Apple’s Final Cut Pro, Live Type, and DVD Studio Pro. I had a lot to learn in a short time, but had no choice, since the director was working on the Mac platform and I wasn’t about to try to figure out how to integrate After Effects with Final Cut at 4 AM with the premiere twevle hours away…

But being an Adobe veteran the comeback of Premiere (and the whole Production Studio suite, apparently) to Mac is welcome news.

Flex 2.0.1 released

Flex 2.0.1 has been released for download from Adobe’s site. I’ve been eagerly awaiting this…I can crash the Mac beta by just typing “//” in the code editor. According to Ted Patrick (http://www.onflex.org/ted/) the 2.0.1 is actually more stable on Mac than Windows. :D

Scroll down the page…and find another surprise…Flex Automation Package, for automated tested of Flex applications!