googleAdsense_widever


actioinscript : adjusting - bright, hue, contrast FLEX/Flash


package 
{
	import flash.display.Sprite;
	import fl.motion.AdjustColor;
	import flash.filters.ColorMatrixFilter;
	import fl.events.SliderEvent;
	
	public class Main extends Sprite
	{
		private var color:AdjustColor = new AdjustColor();
		private var filter:ColorMatrixFilter;
		
		public function Main():void
		{
			/- Required to create initial Matrix *-
			
			color.brightness = 0;
			color.contrast = 0;
			color.hue = 0;
			color.saturation = 0;
			
			/- Add Listeners function *-
			
			addListeners();
		}
		
		private final function addListeners():void
		{
			colorPanel.brightSL.addEventListener(SliderEvent.CHANGE, adjustBrightness);
			colorPanel.contSL.addEventListener(SliderEvent.CHANGE, adjustContrast);
			colorPanel.hueSL.addEventListener(SliderEvent.CHANGE, adjustHue);
			colorPanel.satSL.addEventListener(SliderEvent.CHANGE, adjustSaturation);
		}
		
		private final function adjustBrightness(e:SliderEvent):void
		{
			color.brightness = e.target.value;
			update();
		}
		
		private final function adjustContrast(e:SliderEvent):void
		{
			color.contrast = e.target.value;
			update();
		}
		
		private final function adjustHue(e:SliderEvent):void
		{
			color.hue = e.target.value;
			update();
		}
		
		private final function adjustSaturation(e:SliderEvent):void
		{
			color.saturation = e.target.value;
			update();
		}
		
		private final function update():void
		{
			filter = new ColorMatrixFilter(color.CalculateFinalFlatArray());
			image.filters = [filter];
		}
	}
}

flex에서 사용할 때는 flash 하부에 있는 fl.motion 라이브러리를 해당 프로젝트에 추가해주어야 한다.
경로는 : \Adobe\Adobe Flash CS5\Common\Configuration\ActionScript 3.0\projects\Flash\src\fl\motion

덧글

댓글 입력 영역


공지

어서오십시오.
트위터 : @FCliver
기저심리학 : 네이버카페
카카오톡 : FCliver
페이스북 : Fredric Cliver

통계 위젯 (화이트)

1112
73
284088

접속자 위치