定义Style的语法
引用
<fx:Style>
@namespace_declaration
namespace|Application { style_definition }
</fx:Style>
示例代码:
<fx:Script>
<![CDATA[
[Embed("assets/asterisk_orange.png")]
protected const ICON:Class;
]]>
</fx:Script>
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
s|Button#btn1 {
icon: "assets/asterisk_orange.png";
}
s|Button#btn2 {
icon: Embed("assets/asterisk_orange.png");
}
s|Button#btn3 {
icon: PropertyReference("ICON");
}
</fx:Style>
<s:Button id="btn1" label="Spark Button with dynamic icon" />
<s:Button id="btn2" label="Spark Button with inline embedded icon" />
<s:Button id="btn3" label="Spark Button with metadata [Embed] icon" />
参考链接:
Using local style definitions
http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7e8b.html
如何在Skin中访问其对应的host component?
方法1:通过变量hostComponent
示例代码:
<s:BitmapImage id="icon" horizontalCenter="0" verticalCenter="0"
source="{hostComponent.content}"/>
方法2:通过[SkinPart("false")] + 相同ID
示例代码:
Hosted Component:
[SkinPart("false")]
public var bodyGroup:Group;//变量名必须和Skin中的对应组件的ID相同
Skin:
<s:Group id="bodyGroup" width="160" height="160">
<s:layout>
<lo:FlowLayout horizontalGap="0" verticalGap="0" padding="0"/>
</s:layout>
</s:Group>
如何在ItemRenderer里拿到DataProvider分配的数据?
通过data变量。
为什么给Custom ItemRenderer设置的state没有生效。
需要override getCurrentRendererState函数。
override protected function getCurrentRendererState():String
{
return this.currentState;
}
参考链接:
http://stackoverflow.com/questions/4557168/spark-list-itemrenderer-focus-defaults-the-currentstate
分享到:
相关推荐
详细介绍Flex的项目呈现器的各种初级用法以及高级用法,相当实用。
理解_Flex_itemRenderer 理解_Flex_itemRenderer 理解_Flex_itemRenderer
flex itemRenderer 渲染机制的概念和使用
关于flex的itemRenderer的介绍,还算比较详细。
通过两种方法继承List组件的IconItemRenderer,实现在每个item项中添加组件,如button等
NULL 博文链接:https://hcty31.iteye.com/blog/1190932
Flex项呈示器自定义及使用实例,展示用户信息,包括头像及等级信息。与博客Flex之旅--项呈示器ItemRenderer对应
flex中经常会使用到渲染器,这里简要介绍一下渲染器的一些知识
解决Flex内联itemRenderer的例子
用FLEX4做的项呈现器,仿雅虎聊天界面。 需要的字段为userId、nikeName、sex…… 你可以自行添加 声明,次呈现器只做模版使用。
FLEX4实践—动态生成DataGrid及应用客户化itemRenderer.doc
NULL 博文链接:https://liugang-ok.iteye.com/blog/1135551
itemRenderer里面的内容 获取技巧。
NULL 博文链接:https://baiyejianxin.iteye.com/blog/823229
用flex开发过程中积累下来...Flex实现ColumnChart柱图为圆角矩形的itemRenderer - 代码分享 - 开源中国社区 flex 动态生成柱状图,折线图_IT空间_百度空间 (2) . . . . . . /***************************************/
<![CDATA[ import mx.controls.CheckBox; import mx.controls.Alert; ... Alert.show("行的数据分别是:"+o.idx+"/"+o.... </mx:itemRenderer> </mx:DataGridColumn> </mx:WindowedApplication>
flex中渲染器简介 本系列讨论 Flex itemRenderer 以及如何高效、有效地使用它们。
本文为大家详细介绍下Flex4如何使用itemRenderer 为Tree加线,感兴趣的朋友可以参考下
基于flex的最牛的datagrid做的节目或者课程播表,用ml存储数据,连接到别的页面.
Flex 中如何根据不同行的内容, 动态调整每行的颜色。完整代码