Adobe FLEX 2 - CREATING AND EXTENDING COMPONENTS Manual page 161

Creating and extending flex 2 components
Hide thumbs Also See for FLEX 2 - CREATING AND EXTENDING COMPONENTS:
Table of Contents

Advertisement

bTextChanged = true;
invalidateProperties();
// Changing the text causes the control to recalculate its default size.
invalidateSize();
invalidateDisplayList();
}
// Define a private variable for the alignText property.
private var _alignText:String = "right";
private var bAlignTextChanged:Boolean = false;
public function get alignText():String {
return _alignText;
}
public function set alignText(t:String):void {
_alignText = t;
bAlignTextChanged = true;
invalidateProperties();
invalidateDisplayList();
}
// Implement the commitProperties() method.
override protected function commitProperties():void {
super.commitProperties();
// Check whether the flags indicate a change to both properties.
if (bTextChanged && bAlignTextChanged) {
// Reset flags.
bTextChanged = false;
bAlignTextChanged = false;
// Handle case where both properties changed.
}
// Check whether the flag indicates a change to the text property.
if (bTextChanged) {
// Reset flag.
bTextChanged = false;
// Handle text change.
}
// Check whether the flag indicates a change to the alignText property.
if (bAlignTextChanged) {
// Reset flag.
bAlignTextChanged = false;
// Handle alignment change.
Implementing the component
161

Advertisement

Table of Contents
loading

Table of Contents