Archive for February, 2008

Migrating from Flex 2 to Flex 3

Check this link before migrating your applications from Flex 2 to Flex 3. In my own experience the issues have been very minor and fixed within a few minutes. But your results will varying depending on what controls you’ve used and how large your application is.

http://learn.adobe.com/wiki/display/Flex/Backwards+Compatibility+Issues

Adobe Releases Flex 3 and AIR

It’s finally here: Adobe Flex 3 has offically been released. Check out the press release for all the details. Be sure to check the Flex Product Page. You’ll find a product information, demos, tips, and more on the product pages.

If you have been using Flex 3 Beta – we can’t thank you enough for helping us make the product better. Your Flex 3 Beta 3 licenses should work for a little while longer.

Tip: If you have been using Flex Builder 2 PLUGIN for Eclipse 3.2, and want to move to Flex 3 PLUGIN, I suggest you uninstall the Flex Builder 2 PLUGIN, upgrade to Eclipse 3.3, then install the Flex Builder 3 PLUGIN – a couple more steps but the transition will be cleaner.

If you don’t intend to start using Flex 3 right away, it is still a good idea to move to Flex Builder 3. That’s because Flex Builder 3 can also handle projects created with the Flex 2 SDK. That’s right – Flex 3 can use multiple SDKs. This will allow you to continue to work on your Flex 2 projects AND allow you to explore Flex 3 and test your software with the new SDK.

Here are few more related announcements:

  • opensource.adobe.com/flex & opensource.adobe.com/blazeds projects are live. In addition, we are announcing that we are joining the SQLite Consortium (http://www.sqlite.org).
  • Big companies are launching production apps on Adobe AIR today, concurrent with our release. Press Release
  • 30onAIR – Join in the launch fun by recording a 30-second video on Why Flex, Why AIR or Why CF.

Enjoy!

Gauge Revisited

I received a comment on my recent blog article about the Gauge component wanting to know how to use a graphic skin for the gauge’s needle. I should have included that, but since I didn’t I thought I would supplement the article. As it turns out, you can’t just swap a graphic skin for the programmatic skin – in that version of the Gauge control. My bad.

It has to do with the rotation of the needle. I used the Flex Rotate effect to turn the needle and made it rotate the needle about the needle’s (0,0) point.

The problem with using (0,0) is that in a graphic, you cannot have negative pixels. To center the needle you’d have to draw half of it with negative pixel coordinates. That’s not possible, so I had to come up with another solution.

First, I changed my philosophy of using Rotate. Now, rather than rotating about (0,0) I let Rotate determine the center of the needle and rotate it about its own center point.

I then created another class for the Gauge called GaugeNeedle and it hosts the skin. The Gauge class creates an instance of GaugeNeedle, positions it at (0,0) – the upper left corner of the gauge, and sizes it to match the gauge. If the gauge face is a circle, picture the GaugeNeedle as floating in the center of a box with the box sized to fit the gauge’s face inside of it.

The needle skins are now drawn under the assumption that their centers are aligned with the center of the Gauge. If you were drawing a programmatic needle skin, you’d determine the center point and draw from there. Suppose the Gauge is 200×200 pixels. The GaugeNeedle will be sized to fit 200×200 also. So the needle skin should draw its base at 100,100 and draw the point to the right.

A graphic skin does much the same: you’d make a 200×200 image with a transparent background (PNG works best) and put the needle’s base at 100,100 and draw it pointing to the right.

The needle graphic is positioned so that its base is in the center of the image.

When the needlePlacement value is not "center", the box (GaugeNeedle) is positioned so its center point is shifted to where the needle’s base should be. For instance, if needlePlacement is "left", then the GaugeNeedle is not positioned at (0,0) but somewhere to the left of that so its center point is drawn closer to the left edge of the Gauge face.

The updated code is here for you to download.

I think you’ll find skinning this version of the Gauge a bit easier.

30 on AIR site launches

www.30onair.com site launches tomorrow – Feb 21 2008.

Revised Gauge Control

I’ve been looking over my past posts and thought it was time to update the old Gauge control I introduced way-back-when. In looking over that code I thought it was time for a re-write and a simplification.

This is the result:

This gauge control is simplified in a couple of ways:

  • First, there are just two parts: the face and the needle. Both of these are skins which you can change.
  • Second, the skins are directly ‘attached’ to the control. In the previous versions of this component I had created classes which then held the skins. I wanted to show you a more simplified approach and it works well here.

Continue reading…

creationPolicy vs Binding

I just read a comment on an article I wrote a few years ago, creationPolicy vs. Form Data. The commenter suggested that the Save button must be able to read the values from the controls, even if those controls haven’t been created – probably to make the code easier to write or at least consistent.

I disagree with this, but after reading that article again, I see that I could have given more information to support my position.

Continue reading…