Flex中CSS样式的切换

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="955" minHeight="600"
				creationComplete="init();"
				>
	
	<mx:Script>
		<![CDATA[
			private function init():void {
				StyleManager.loadStyleDeclarations('style1CSS.swf');
			}
		]]>
	</mx:Script>
	
	<mx:ComboBox 
		id = "styleCombo" top="10" left="10" right="10"
		dataProvider="['style1CSS', 'style2CSS', 'style3CSS']"
		change="StyleManager.loadStyleDeclarations(styleCombo.selectedItem + '.swf')"
		/>
	
</mx:Application>

 

 

Flex中CSS样式的切换

 

style1CSS.css定义了Application容器的背景色与背景图:

Application { 
   backgroundImage: Embed(source="assets/backgrounds.swf#bluestripe");
   themeColor: #009999;
}

 

style2CSS.css为:

Application { 
   backgroundImage: Embed(source="assets/brushedmetal.jpg");
   themeColor: #0033cc;
}

 

style3CSs.css为:

Application { 
   backgroundImage: Embed(source="assets/backgrounds.swf#retroFifties");
   themeColor: #ff9900;
}

 

运行的效果图:

Flex中CSS样式的切换

 

实例与资源请到这个地址下载自行测试:www.idceye.com/blog/post/281/

上一篇:Struts2 的Action中取得请求参数值的几种方法


下一篇:Spring MVC无法获取到页面表单put过来的参数的解决方案