flex example

warning: Creating default object from empty value in /home/nbilyk/nbilyk.com/wwwroot/modules/taxonomy/taxonomy.pages.inc on line 34.

Flex textheight workaround

I spent over an hour banging my head against the wall on this one, so I'm going to post my solution.

If you have a Flex Text component, text.textHeight gives you an incorrect result in certain situations. This is a known bug, I see it listed
http://bugs.adobe.com/jira/browse/SDK-14792 (VOTE FOR IT!) and


Variables and constants

Actionscript 3 guide to constants and variables.

This article assumes you have a knowlege of Classes and instances.

public class Cow extends Mammal {
	protected static const NUM_LEGS:uint = 4;

Let's dissect this cow, specifically, the NUM_LEGS constant.

There are 6 parts to this declaration:

I'm going to explain them backwards in order to go from simplest to most complicated.


Flex states retaining memory

This is an old post that explains how flex states work, how creating a state creates a Factory that holds a hard reference to the state, and a workaround for states if you want to be able to release the memory of a state.

Since this post, I've learned a few things, and before reading, I want to make a few corrections.


Flex verticalScrollPolicy bug

When you have content with width set to 100%, and verticalScrollbarPolicy set to auto, when you resize the window so the vertical scrollbar is needed, you would expect the content area to adjust to handle the newly added vertical scrollbar, but it doesn't. What happens instead is a horizontal scrollbar appears.

To reproduce this bug:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:local="*">
	<mx:Canvas width="100%" height="700"/>


Flash E4X Tutorial

This is a beginner's guide to E4X.
Flash has some good documentation on using E4X at:
but it's hard to digest all that if you're just getting started.

You can download the example attached below and follow along.

Loading xml

Before we begin parsing any xml, I'll explain briefly how to load the xml.


Copying typed objects

Attached below is a utility class with 3 static methods:

  • clone
  • compare
  • mergeObjects

Clone lets you copy Objects and Arrays. If you copy a different class, the public properties (and recursive public properties) will get transferred, but the private properties won't. Also, the cloned object can only be of type Object or Array.

Compare lets you compare recursively the public properties of two objects or arrays. Useful for multi-dimensional arrays.


RIATest review

This is an article about using RIATest, along with a video demonstrating creating and running a basic test.


Removing label from ProgressBar

In case this saves anybody some time. Removing the label from a flex ProgressBar isn't exactly straightforward. This is what I had to do:

<mx:ProgressBar label="" labelPlacement="right" labelWidth="0" horizontalGap="0" />


Flex localization example

Earlier I posted how to do Flash localization. Now it's time for an example of Flex localization. Flex localization is a bit more difficult to do, but it's a lot better done. Follow along with the example attached at the bottom of the post.

This example is for Runtime localization. This means that the resource bundles will be external swf files and will not be compiled into your main application.

Syndicate content