Monthly Archives: November, 2007

Use Fade without embedding fonts (in Moxie)

Every now and then, a bug fix comes along and you just want to jump for joy and say “hallelujah!”. Well, last week, one of those came in. The team has been pretty tight in selecting bugs to get fixed lately, but, I thought, it wouldn’t hurt to ask to have SDK-12901 fixed. This bug is one of many that complains that you cannot use a fade effect on any text unless the font for the text is embedded. This is one of the first things that Flex developers run into when they begin to use effects, like Fade. For a long time, we couldn’t fix this since there was a Flash Player limitation. However, a workaround has been provided to us by the player team in recent months. So, coming in Moxie … (drumroll, please) … you will be able to Fade text without embedding your fonts. This hasn’t been fully tested yet, so, some bugs may still be lingering, but, it has been checked in and I verified that it did work with a < mx:Label > and a Fade. Here was the checkin notice:

Change 188500 by jszeto@JSZETO-XP on 2007/11/20 20:20:51

Flex SDK Beta3 Bug Fix

SDK-12901 – Add support for system text in the Fade Effect

Applying a filter to a DisplayObject forces the Player to create a bitmap of that object. System font text can not be alpha’ed. But bitmaps can. So, in FadeInstance, I apply a BlurFilter (with values set to 0) to the target if the target doesn’t have any current filters. When the effect ends, we remove the temporary filter.

Bugs: SDK-12901
QA: Yes
Doc: Yes!!!!

Workaround for selectedIndex on Tree not showing up

In some situations, after you have changed or loaded data in a List component like Tree, the selectedIndex doesn’t show up in the UI. In the example below, you have a Tree where you change the dataProvider. After changing the dataProvider, the selectedIndex is changed with the following code:

myTree.dataProvider = treeData2;
myTree.selectedIndex = 1;

However, if you run the Application, the dataProvider is changed, but, the selectedItem in the Tree does not show up. Why?? See the bug demo here: ListDataProviderChange_Bug.swf . The code that includes this bug can be found here: ListDataProviderChange_Bug.mxml.

The reason that this happens is because the control needs to go through a full validation pass in order to set up the collection event listeners and take any data changes. Therefore, the solution to get this to work is ONE LINE. Don’t you love one line fixes? Add a call to validateNow() to your code. So, the code should be:

myTree.dataProvider = treeData2;
myTree.validateNow();
myTree.selectedIndex = 1;

Here is the demo of the working example: ListDataProviderChange.swf

Here is the full example code: ListDataProviderChange.mxml

By the way, this bug is discussed in public bug SDK-11424