Žymos: development

Flex memo: avoiding weird application behaviour

Sukurta 2009-11-12 21:44 

While writing apps with Adobe Flex framework I have experienced a few situations when my programs started acting strangely. Actually, very strangely. So I've made up a list of things I should always remember (and probably you should) in order to avoid such situations:

  • when creating istances of XML object, always provide initial data for constructor. Do not ever try doing something like this: var xml: XML = new XML ();.  This might make your application go crazy. In my case Flash debugger was jumping to random places all over the code and needless to say nothing worked as expected. Personally I like initializing XML variables just like this: var xml: XML = <name/>;.
  • When creating skins for SkinnableComponent or any component extending it always set minWidth and minHeight properties to 0 (zero) or any other value you need. Otherwise components contained within this SkinnableComponent might start acting strangely or you might not see them on the screen at all. This, of course, applies only to Flex 4.

I hope this will help someone to avoid wasting time for tracking strange behaviour of Flex applications. And in the future I expect this list to be even longer. Cheers!

Stupid me! Again...

Sukurta 2010-04-24 23:01 

Check this out:

// Create background image component if we got background
if (_backgroundData != null)
{
   _backgroundComponent = new BitmapImage();
   _backgroundComponent.smooth = true;
   _backgroundComponent.fillMode = BitmapFillMode.REPEAT;
   _backgroundComponent.width = _size.x;
   _backgroundComponent.height = _size.y;
   addElement(_backgroundComponent);
}

Does anyone see _backgroundComponent.source = _backgroundData ? Not me! I should sometimes shoot myself...

Spreadfirefox Affiliate Button Valid XHTML 1.0 Transitional Valid CSS!