1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
package classesAS.composants
{
import mx.containers.FormItem;
[Style(name="verticalAlign", type="String", inherit="no")]
public class MyFormItem extends FormItem
{
public function MyFormItem()
{
super();
}
override protected function updateDisplayList(w:Number, h:Number):void {
super.updateDisplayList(w, h);
var verticalAlign:String = getStyle("verticalAlign");
if (verticalAlign == "middle") {
itemLabel.y = Math.max(0, (h - itemLabel.height) / 2);
} else if (verticalAlign == "bottom") {
var padBottom:Number = getStyle("paddingBottom");
itemLabel.y = Math.max(0, h - itemLabel.height - padBottom);
}
}
}
} |