Archive for December, 2006


December 29, 2006

===(strict equal operator)

“Tests two expressions for equality; the strict equality (===)operator performs in the same way as the equality (==) operator, except that data types are not converted. The result is true if both expressions, including their data types, are equal. ”


var tfrmt:TextFormat = new TextFormat();

var attr:String = “font”;

trace( tfrmt[attr]==null); //”true”

trace( tfrmt[attr]==undefined); //”true”

trace( tfrmt[attr]===null); //”true”

trace( tfrmt[attr]===undefined); //”false”


textWidth vs. _width

December 28, 2006

Some simple test seems to reveal that “textWidth/textHeight” is closer to my straightforward understanding of how wide/high a textfield is. (“_width/height” seems to be the dimension of the “movieclip” boundary of the textfield, which is defined when calling createTextField() .) In short, “textHeight/textWidth” will be smaller than “_width/_height”.

Also, “textHeight/textWidth” is not affected by “autoSize” attribute.

zero margin body

December 9, 2006

<body leftmargin=”0″ topmargin=”0″ marginheight=”0″ marginwidth=”0″>

where to define UI event handlers

December 2, 2006

It depends.

If the event only affects the UI component itself that broadcasts it (like in a simple scenario of a button being rolled over) but not others, the event handler can be part of that UI component methods.

But in most cases, the event will possibly affect other elements in the app. Like clicking one button will require the visual state change of another button in the same group, as in the case of a menubar. The event handler would be better end up in another place, or in more than one place. For example, a layout manager (menubar class) will handle the click event of individual buttons, while the button itself will define some handlers that’s always going to be executed regardless of the state of other elements in the group. In either cases, the UI component’s major responsibility will be just to provide API for changing the state of itself. It’s up to the layout manager to handle the event.

Like in a real analogue, a team member only tells what she is capable of doing; it’s up to her manager to decide what she really does and make the final call.