当前位置: 代码迷 >> Web前端 >> 批改ScrollBar的ScrollTrack高度
  详细解决方案

批改ScrollBar的ScrollTrack高度

热度:150   发布时间:2012-11-15 15:16:15.0
修改ScrollBar的ScrollTrack高度
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="application1_creationCompleteHandler(event)" minWidth="955" minHeight="600">
	<mx:Script>
		<![CDATA[
			
			import mx.core.mx_internal;
			import mx.events.FlexEvent;
			
			

			protected function application1_creationCompleteHandler(event:FlexEvent):void
			{
				// TODO Auto-generated method stub
				
				cb.mx_internal::downArrowButton.styleName="";
				
				abc.verticalScrollBar.mx_internal::scrollTrack.y=10;
				abc.verticalScrollBar.mx_internal::scrollTrack.mx_internal::$height-=20;
				abc.verticalScrollBar.mx_internal::scrollThumb.y+=3;
				abc.verticalScrollBar.mx_internal::scrollThumb.mx_internal::setRange(
					abc.verticalScrollBar.mx_internal::scrollTrack.y+3,
					abc.verticalScrollBar.mx_internal::scrollTrack.y-3+abc.verticalScrollBar.mx_internal::scrollTrack.height-abc.verticalScrollBar.mx_internal::scrollThumb.height-20,
					abc.verticalScrollBar.minScrollPosition,
					abc.verticalScrollBar.maxScrollPosition);
				
			}

		]]>
	</mx:Script>
	
	<mx:Array id="arr">
		<mx:Object label="One" />
		<mx:Object label="Two" />
		<mx:Object label="Three" />
		<mx:Object label="Four" />
		<mx:Object label="Five" />
		<mx:Object label="Six" />
		<mx:Object label="Seven" />
		<mx:Object label="Eight" />
		<mx:Object label="Nine" />
		<mx:Object label="Ten" />
	</mx:Array>
	<mx:Style>
		
		.abc
		{
			background-color:#993300;
			
		}
		.c1{
			trackSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_track");
			
			thumbOverSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_thumb");	
			thumbUpSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_thumb");
			thumbDownSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_thumb");
			
			upArrowSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_up");
			upArrowOverSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_up");
			upArrowDownSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_up");
			
			
			downArrowSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_down");
			downArrowOverSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_down");
			downArrowDownSkin: Embed(source="/assets/swf/Icon.swf",symbol="scroll_down");

		}
	</mx:Style>
	
	<mx:Canvas id="abc" width="100" height="100" verticalScrollBarStyleName="c1" backgroundColor="#993300" x="10" y="50">
		<mx:Label y="200" text="124235345"/>
	</mx:Canvas>

	<mx:ComboBox id="cb" dataProvider="{arr}" styleName="abc" >
	</mx:ComboBox>
</mx:Application>

?