flex example
Better FormItem
Read more...
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 and
http://www.mail-archive.com/flexcoders@yahoogroups.com/msg63011.html.
Read more...
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:
protected
static
const
NUM_LEGS
:uint
4
I'm going to explain them backwards in order to go from simplest to most complicated.
Read more...
Flex states retaining memory
I use flex states a lot. I think they're a great way to handle navigation within your application. However, I have recently discovered that any mxml component added with AddChild will not and can not be removed from memory. This isn't a problem with small applications, but with large ones, this is pretty awful. It's not technically a memory "leak" because going back and forth between two states won't pile on the memory, but every state you navigate to will never be released.
Read more...
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"/> </mx:Application>
Read more...
Flash E4X Tutorial
This is a beginner's guide to E4X.
Flash has some good documentation on using E4X at:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/index.html?XML.html&class-list.html,
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.
Read more...
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.
Read more...
RIATest review
Read more...
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" />
Read more...
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.
Read more...