I'm writing an extension to the Flex DataGridColumn class. I want to override the editable and sortable properties so that I can dispat开发者_开发问答ch an event in the setter. So I looked up the method signature from the Adobe Docs (I'm using Flex 3.5 compiler):
Language Version: ActionScript 3.0
Implementation
public function get editable():Boolean
public function set editable(value:Boolean):void
public var sortable:Boolean
I should be able to override both the setter for editable, and use a setter to override the functionality of sortable.
in my code I have:
public override function set editable(value:Boolean):void {
super.editable = value;
//code to dispatch event
}
and
public override function set sortable(value:Boolean):void{
super.sortable = value;
//code for event
}
However I get a #1023 error : Incompatible override. I've tried all sorts of combinations on the method signatures, but these are exactly the same as the ones in the docs above.
What gives? Am I missing something obvious?
EDIT: Apparently the documentation is not in line with the actual source code. Both editable and sortable are variables in DataGridColumn.as. Anyway I can override them with a setter/getter without modifying the base class? DataGridColumn.as Source:
public var editable:Boolean = true;
public var sortable:Booelan = true;
You cannot override variable as property(get/set). BTW, editable
and sortable
became properties in SDK 4.0.
精彩评论