Flex List行背景色
过去在对DataGrid设置行背景色时,感觉还是挺方便的,只要重写DataGrid的,如下
private var _rowColorFunction:Function;
public function set rowColorFunction(f:Function):void
{
this._rowColorFunction = f;
}
public function get rowColorFunction():Function
{
return this._rowColorFunction;
}
override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
{
if (this.rowColorFunction != null) {
if (dataIndex < this.dataProvider.length) {
var item:Object = this.dataProvider.getItemAt(dataIndex);
color = this.rowColorFunction.call(this, item, color);
}
}
super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
}
如果你还是不是很明白可以参考我以前的博客http://blog.csdn.net/terryzero/archive/2009/10/12/4657277.aspx
今天我碰到个需求是要对List行变色,由于我想DataGrid和List都是继承与ListBase,都有 override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void
这个方法,所以我就想当然,照葫芦画瓢,也重写了这个方法,但经过调试怎么也调用不到这个方法。搞的我非常费解,难道这个方法没用的啊?网上查了好久,国内没啥这方面的好文章,突然一篇国外的文章启发了我。如下
All the listy components in Flex (List, Datagrid, Tree, etc.) have a protected method called drawRowBackground which is in charge of drawing the background for a given row. You typically use it to color a given row based on some facet of the data the row represents (e.g. red background for rows with a negative bank balance).
With DataGrid, it's easy to use, just subclass DataGrid and override the method, parameterized so you can pass in a function to compute the color for each row based on the row index/data/original color/etc. With List (and since ComboBox uses a
相关文档:
flex和后台交互数据最重要是通过异构传输的httpserivce的xml结构。而高效率合理的异步传输数据是flex的开发中的核心。我就公开一下自己面向接口的httpservice的写法。希望有人可以指正。
首先第一个接口是决定通过获取xml的接口:
package com.sunshine.framework. ......
http://corlan.org/2008/11/13/flex-and-php-remoting-with-zend-amf/ ZEND+FLEX收藏
http://www.keithcraigo.com/archives/66ZEND+FLEX认证
http://www.keithcraigo.com/archives/181ZEND+FLEX认证
http://ressources.mediabox.fr/tutoriaux:flashplatform:dynamique:remoting:zendlogin:zendlogin1ZEND+FL ......
Flex最强大的特性之一就是它在标签和
ActionScript类之间创建了一个简单的映射。这是一个简单的概念,但是我多次发现不懂Flex的人对这点是如何工作的或者‘它为什么有用’理解
起来有困难。
对那些学习Flex的新手,这里有一些规则以及
一些简单的例子让你们以此开始学习这个特性。
例子 1 —— ......
metadata最先开始于dotnet吧,叫做Attribute;然后java也紧随其后,叫做Annotaion;actionscript则叫做Metadata。其中dotnet与ActionScript的语法格式上都是相似的,如AS中的[Bindable]。在Java中则是用@XXX这样的语法,如@override。不过目的都是一个,给类或方法或属性增加meta data标记,从而实现对这些被标记的代码进行 ......
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
//导入 ......