Sunday, November 16, 2008

Focus in all cases

Have you also noticed that Flex draws a focus border around its components when you give them focus using the keyboard (by using the tab button)?

Great but why is the focus border not drawn when using the mouse to give a component the focus?

The solution is simple: extend the existing components and force the border drawing yourself:

<mx:CheckBox
      xmlns:mx="http://www.adobe.com/2006/mxml"
      focusIn="onFocusIn()">
<mx:Script>
//
// Support to draw the focus border on focusIn
//
private function onFocusIn(): void
{
      this.drawFocus(true);
}
</mx:Script>
</mx:CheckBox>

Thursday, November 13, 2008

Discount code for Adobe Max in Milan

It seems that those who haven't registered yet for Adobe Max can get in for less than those who registered a month ago. Interested in knowing more? Just contact me.

Saturday, November 8, 2008

"Classes must not be nested" error

If you ever come across the "classes must not be nested" error (and/or the "internal build" error) then you're in trouble :) There are different possible causes for these errors. In my case it was because I was referring to a none existing component from within an itemRenderer. A good list with a number of potential causes can be found on http://rjowen.wordpress.com/2007/06/21/internal-build-error-or-classes-must-not-be-nested-error/.

Saturday, September 27, 2008

FileReference events not firing?

If the UPLOAD_COMPLETE_DATA event (or any other FileUpload related event) isn't fired after a succesful upload then you need to check whether your page returns something. It's enough that it just returns for example 'OK' but it at least has to return something.

Tuesday, August 5, 2008

Certified Adobe Flex Developer

I've waited and waited but it seems that the Adobe Flex 3 certification exam won't come before the release of Adobe Flex 4... Therefore I finally decided to do the Adobe Flex 2 certification and guess what: I passed :) It was a nice bunch of questions, some on UI, some on application design (even some UML) and some on data services. Most of them were 'practical' question but of course some are less 'obvious'.

Wednesday, June 18, 2008

Where to put your removeEventListeners?

Everyone tells you to make sure to execute a removeEventListener for each addEventListener but where do you put this code? Most people put their addEventListeners in the creationComplete event but there's no destructionComplete event...

There are 2 options:
  • Or you don't use removeEventListener and make sure that you use a weak reference when doing addEventListener (setting the 5th parameter of addEventListener to true)
  • Or you attach event listeners in the "addedToStage" event and you remove them again in the "removedFromStage" event

Why Adobe didn't set the 'weak reference' parameter by default to 'true' is unclear to me. The current situation is probably one of the major causes of memory leaks in Flex applications...

Degrafa component not showing up?

There seems to be some problem when building a Degrafa component in MXML. It seems that using "Surface" as the outer container results in an invisible component. The workaround is simple: put a Canvas around it but don't ask me why :)