Process of Coustome componet
a) Extend which componts wat to customise (eg: UIComponent.)
public class ModalText extends UIComponent
————————————————————-
b) Implement the class constructor.
public function ModalText()
{
super();
}
————————————————————-
c) Define variables for the two child components.
private var text_mc:TextArea;
————————————————————-
d) Embed new skins used by the Button component.
[Embed(source="button.png")]
public var modeUpSkinName:Class;
————————————————————-
e) Implement the createChildren() method.
override protected function createChildren():void
{
super.createChildren();
addChild(text_mc);
}
————————————————————-
f) Implement the commitProperties() method.
override protected function commitProperties():void
{
super.commitProperties();
invalidateDisplayList();
}
————————————————————–
g) Implement the measure() method.
override protected function measure():void
{
super.measure();
var buttonWidth:Number = mode_mc.getExplicitOrMeasuredWidth();
var buttonHeight:Number = mode_mc.getExplicitOrMeasuredHeight();
measuredWidth = measuredMinWidth = text_mc.measuredWidth + buttonWidth;
measuredHeight = measuredMinHeight = Math.max(mode_mc.measuredHeight,buttonHeight) + 10;
}
—————————————————————
h) Implement the updateDisplayList() method.
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
}
—————————————————————
i) Add methods, properties, and metadata.