1
<mx:TileList id="tl" allowMultipleSelection="true">
<mx:itemRenderer>
<mx:Component>
<mx:VBox height="100%"width="100%" borderSides="borderStyle="solid">
<mx:Text id="txt1" text="{getText(XML(data))}" selectable="{_selectable}" />
<mx:Script>
<![CDATA[
import mx.controls.listClasses.IListItemRenderer;
public override function set data(obj:Object):void{
//this override function works alright
}
private function getText(data:XML):String{
// some logic inside this function. Works fine.
}
override protected function drawSelectionIndicator(indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void{
//this function gives me compile error - "Method marked override must override another method" }
]]>
</mx:Script>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
現在我知道我可以做其他類和擴展的TileList和覆蓋此方法有,它會正常的工作,因爲它會找到方法在超被覆蓋類的範圍。但我實際上想在組件級別進行內聯操作(我不想創建另一個文件,每次我必須在tilelist,datagrid等中進行小修改)。TileList中的itemRenderer錯誤:標記覆蓋必須覆蓋另一種方法
-------------------------- FULL CODE Prototype(with function logic not written)---------
<mx:VBox horizontalAlign="center" verticalAlign="middle">
<mx:HorizontalList id="headerList" width="100%" columnCount="7" paddingBottom="0" selectable="false" columnWidth="98" rowHeight="40">
<mx:dataProvider>
<mx:Array>
<mx:String>Sunday</mx:String>
<mx:String>Monday</mx:String>
<mx:String>Tuesday</mx:String>
<mx:String>Wednesday</mx:String>
<mx:String>Thursday</mx:String>
<mx:String>Friday</mx:String>
<mx:String>Saturday</mx:String>
</mx:Array>
</mx:dataProvider>
<mx:itemRenderer>
<mx:Component>
<mx:VBox backgroundAlpha="0.8" height="100%" width="100%" horizontalAlign="center" paddingTop="0" verticalAlign="middle" borderSides="bottom left right" borderStyle="solid">
<mx:Label text="{data}" fontWeight="bold"/>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:HorizontalList>
<mx:TileList id="tl" allowMultipleSelection="true" mouseOver="tl.setStyle('backgroundColor','0xFFFFFF')" paddingTop="0" height="100%" width="100%" borderSides="none" dataProvider="{IndividualData.w.s}" maxRows="4" maxColumns="7" columnCount="7" rowCount="4" rowHeight="110" columnWidth="98">
<mx:Script>
<![CDATA[
import mx.controls.listClasses.IListItemRenderer;
protected override function drawSelectionIndicator(indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void{
return;
}
]]>
</mx:Script>
<mx:itemRenderer>
<mx:Component>
<mx:VBox height="100%" horizontalAlign="center" width="100%" borderSides=" top bottom left right" borderStyle="solid"
click="outerDocument.onItemClick(event,XML(data));onEdit()" doubleClickEnabled="true" doubleClick="onScheduleDetail([email protected])"
verticalAlign="middle" mouseOver="onMouseOver()" mouseOut="onMouseOut()"
backgroundColor="{_bgColor}">
<mx:Text id="txt1" text="{getText(XML(data))}" selectable="{_selectable}" />
<mx:Script>
<![CDATA[
import mx.controls.listClasses.IListItemRenderer;
import mx.core.UIComponent;
import com.smartLinx.utils.DateUtils;
import com.smartLinx.utils.Helper;
import com.smartLinx.utils.DateUtils;
import com.smartLinx.ScheduleOptimizer.components.ScheduleDetail;
import mx.managers.PopUpManager;
[Bindable] private var _bgAlpha:Number;
[Bindable] private var _selectable:Boolean;
[Bindable] private var _bgColor:uint;
[Bindable] private var _pastDated:Boolean;
/* override protected function drawSelectionIndicator(indicator:Sprite, x:Number, y:Number, width:Number, height:Number, color:uint, itemRenderer:IListItemRenderer):void
{
return;
} */
private function getText(data:XML):String
{
// }
private function onMouseOver():void{
}
private function onMouseOut():void{
}
private function onEdit():void{
}
public override function set data(obj:Object):void
{
super.data = obj;
}
private function onScheduleDetail(work_date:String):void
{
}
]]>
</mx:Script>
</mx:VBox>
</mx:Component>
</mx:itemRenderer>
</mx:TileList>
</mx:VBox>
</mx:VBox>
我已經嘗試過 - 認爲在父節點它可能工作 - 但同樣的錯誤。 – Tintin
你在開玩笑或做錯事。在我的IDE中成功完成。 – Constantiner
仍然是一樣的錯誤。我的tilelist深入VBox的內部。我不知道我做錯了什麼? – Tintin