| <?xml version="1.0" encoding="utf-8"?> |
| <!-- |
| |
| Licensed to the Apache Software Foundation (ASF) under one or more |
| contributor license agreements. See the NOTICE file distributed with |
| this work for additional information regarding copyright ownership. |
| The ASF licenses this file to You under the Apache License, Version 2.0 |
| (the "License"); you may not use this file except in compliance with |
| the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
| |
| --> |
| <s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" xmlns:s="library://ns.adobe.com/flex/spark" autoDrawBackground="false"> |
| <fx:Script> |
| <![CDATA[ |
| |
| override public function set data(value:Object):void { |
| super.data = value; |
| |
| if(value == null){ |
| // the guts behind virtualization will set the data to null sometimes |
| return; |
| } |
| |
| lbl.text = data.myItemIndex; |
| |
| if (value.majorAxis == "vertical"){ |
| // majorSize is height |
| |
| this.width = value.minorSize; |
| this.height = value.majorSize; |
| |
| } else if (value.majorAxis == "horizontal") { |
| // majorSize is width |
| this.width = value.majorSize; |
| this.height = value.minorSize; |
| |
| } else { |
| throw new Error('invalid axis'); |
| } |
| |
| } |
| ]]> |
| </fx:Script> |
| |
| <s:states> |
| <mx:State name="normal"/> |
| <mx:State name="hovered"/> |
| <mx:State name="selected"/> |
| </s:states> |
| |
| <s:Rect top="0" left="0" right="0" bottom="0"> |
| <s:fill> |
| <mx:SolidColor color="0xA8C6EE" |
| color.hovered="0xCEDBEF" |
| color.selected="0xCCCCCC" /> |
| </s:fill> |
| </s:Rect> |
| |
| <mx:Label id="lbl" top="1" left="1" /> |
| |
| </s:ItemRenderer> |
| |