⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 projectlistviewsbar.mxml

📁 flex 实现的一个showcase 喜欢flex的朋友可以
💻 MXML
字号:
<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas
	xmlns:mx="http://www.adobe.com/2006/mxml"
	
	width="96"
	height="31"
	
	horizontalScrollPolicy="off"
	verticalScrollPolicy="off"
	
	creationComplete="creationCompleteHandler(event)">
	
	
	<mx:Script>
		<![CDATA[
		
			//////////////////////////////////////////////////
			//import
			
			import com.flexShowcase.constants.ProjectListViews;
			import com.flexShowcase.events.ProjectListEvent;
			
			//////////////////////////////////////////////////
			//getter/setter variables
			
			private var _selectedView:String;
			
			//////////////////////////////////////////////////
			//getter/setter functions
			
			public function set selectedView(value:String):void {
				if (_selectedView != value) {
					_selectedView = value;
					
					selectedViewHandler();
				}
			}
			public function get selectedView():String{
				return _selectedView;
			}
			
			//////////////////////////////////////////////////
			//initialization
			
			private function creationCompleteHandler(event:Event):void {
				selectedViewHandler();
			}
			
			//////////////////////////////////////////////////
			//private functions
			
			private function dispatchProjectListChangeViewEvent(selectedView:String):void {
				var projectListEvent:ProjectListEvent = new ProjectListEvent(ProjectListEvent.CHANGE_VIEW);
				projectListEvent.selectedView = selectedView;
				
				dispatchEvent(projectListEvent);
			}
			
			
			//////////////////////////////////////////////////
			//getter/setter handler functions
			
			private function selectedViewHandler():void {
				var radioButton:RadioButton;
				
				switch (selectedView) {
					case ProjectListViews.HYBRID :
						radioButton = hybridViewRadioButton;
						break;
					case ProjectListViews.TEXT :
						radioButton = textViewRadioButton;
						break;
					case ProjectListViews.THUMBNAIL :
						radioButton = thumbnailViewRadioButton;
						break;
					case ProjectListViews.DEFAULT :
						radioButton = thumbnailViewRadioButton;
						break;
				}
				
				if (radioButton != null) {
					radioButton.selected = true;
					
					dispatchProjectListChangeViewEvent(selectedView);
				}
			}
			
			private function viewButtonsGroupClickHandler(event:Event):void {
				event.stopPropagation();
				
				var radioButton:RadioButton = event.target as RadioButton;
				
				var view:String;
				
				switch (radioButton) {
					case textViewRadioButton :
						view = ProjectListViews.TEXT;
						break;
					case hybridViewRadioButton :
						view = ProjectListViews.HYBRID;
						break;
					case thumbnailViewRadioButton :
						view = ProjectListViews.THUMBNAIL;
						break;
				}
				if (view != selectedView) {
					dispatchProjectListChangeViewEvent(view);
				}
			}
			
			
		]]>
	</mx:Script>
	
	
	<mx:Image source="@Embed('/assets/images/frontend/projectlist/projectList_viewsButtons_bg.png')" />
	
	<mx:RadioButtonGroup id="viewButtonsGroup" />
	<mx:RadioButton id="textViewRadioButton" styleName="projectListViewRBText" x="4" y="2" 
		groupName="viewButtonsGroup" toolTip="View list as text" buttonMode="true" 
		click="viewButtonsGroupClickHandler(event)" />
	<mx:RadioButton id="hybridViewRadioButton" styleName="projectListViewRBCombo" x="33" y="2" 
		groupName="viewButtonsGroup" toolTip="View list as text and thumbnails" buttonMode="true" 
		click="viewButtonsGroupClickHandler(event)" />
	<mx:RadioButton id="thumbnailViewRadioButton" styleName="projectListViewRBThumb" x="63" y="2" 
		groupName="viewButtonsGroup" toolTip="View list as tiled thumbnails" buttonMode="true" 
		click="viewButtonsGroupClickHandler(event)" />
	
	
</mx:Canvas>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -