flex4 css的多种用法
来源:互联网 发布:金大师交易软件 编辑:程序博客网 时间:2024/06/05 00:16
原文地址: http://ghostjay.blog.51cto.com/2815221/600912
下面给出一段示例代码:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" >
<s:layout>
<s:VerticalLayout horizontalAlign="center" paddingTop="20"/>
</s:layout>
<fx:Style>
@namespace mx "library://ns.adobe.com/flex/mx";
@namespace s "library://ns.adobe.com/flex/spark";
global {
font-family:Times New Roman, Times, serif;
color:purple;
}
s|Label
{
font-size:18;
font-style:italic;
}
//descendant selector,要完全符合这样的层次才能有效,见结果
s|HGroup s|Button s|Label
{
font-style:normal;
font-weight:bold;
}
//name selector
.redFont
{
color:#ff0000;
}
</fx:Style>
<s:VGroup>
<s:Label text="Hello World" styleName="redFont"/>
<s:Button label="Click me"/>
</s:VGroup>
<s:HGroup>
<s:Label text="Hello World"/>
<s:Button label="Click me"/>
</s:HGroup>
</s:Application>
运行结果为:
==========================================
如果将style保存为css文件:
//ExternalStyles.css
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
global {
font-family:Times New Roman, Times, serif;
color:purple;
}
s|Label
{
font-size:18;
font-style:italic;
}
s|Button s|Label
{
font-style:normal;
font-weight:bold;
}
.redFont
{
color:#ff0000;
}
再修改mxml文件为:
//ExternalStyles.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" >
<s:layout>
<s:VerticalLayout horizontalAlign="center" paddingTop="20"/>
</s:layout>
<fx:Style source="ExternalStyles.css"/>
<s:VGroup>
<s:Label text="Hello World" styleName="redFont"/>
<s:Button label="Click me"/>
</s:VGroup>
<s:HGroup>
<s:Label text="Hello World"/>
<s:Button label="Click me"/>
</s:HGroup>
</s:Application>
则运行结果一样
- flex4 css的多种用法
- FLEX4 CSS用法
- Flex4下的CSS规则
- Flex4 <s:DataGrid> 的用法
- flex4 RemoteObject 的用法详解
- FLEX4 CSS
- assert的多种用法
- Secretary的多种用法
- map的多种用法
- 定时器的多种用法
- TextView的多种用法
- c的多种用法
- AJAX的多种用法
- flex4 中Array 与ArrayCollection的用法
- CSS的多种浏览器兼容性问题
- css tab的多种样式
- css居中的多种方法
- 关于sprintf的多种用法
- 字符串函数--startsWith--endsWith--toLowerCase--toUpperCase学习
- WINCE .net Compact Framework 2.0 路径
- Sed (1)
- shell中一些特殊符号的用法总结
- 107个javascript常用语句
- flex4 css的多种用法
- 做点事情很难啊!
- python re 正则表达式之二
- Android JNI 使用的数据结构JNINativeMethod详解
- 顺序表查找算法
- 搭建Windows Embedded Compact 7开发环境
- android系统启动及wifi框架分析
- ARMV4,ARMV4,ARMV4I
- 中国linux现状