2010년 3월 18일 목요일

(1) ColorTransform 예제

[code as3]
package
{
import flash.display.Sprite;
import flash.geom.ColorTransform;
import fl.events.SliderEvent;

public class ColorTransformExample extends Sprite
{
 public function ColorTransformExample()
 {
  super();
  configure();
 }

 public function configure():void
 {
  red.maximum = 10;
  red.minimum = -10;
  red.value = 10;
  green.maximum = 10;
  green.minimum = -10;
  green.value = 10;
  blue.maximum = 10;
  blue.minimum = -10;
  blue.value = 10;

  red.addEventListener(SliderEvent.THUMB_DRAG, changeColorHandler);
  green.addEventListener(SliderEvent.THUMB_DRAG, changeColorHandler);
  blue.addEventListener(SliderEvent.THUMB_DRAG, changeColorHandler);
 }

 public function changeColorHandler(event:SliderEvent):void
 {
  var ct:ColorTransform = pic.transform.colorTransform;
 
  ct.redMultiplier = red.value / 10;
  ct.greenMultiplier = green.value / 10;
  ct.blueMultiplier = blue.value / 10;
  pic.transform.colorTransform = ct;
 }
}
}
[/code]

 

댓글 없음:

댓글 쓰기