色確認用
ColorTransFormの色確認用
CopyClipボタンでColorTransFormのコードがクリップボードに入ります
/**
* Copyright HaraMakoto ( http://wonderfl.net/user/HaraMakoto )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/5j5w
*/
package {
import com.bit101.components.HUISlider;
import com.bit101.components.Label;
import com.bit101.components.PushButton;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.geom.ColorTransform;
import flash.system.System;
/*
ColorTransFormの色確認用
CopyClipボタンでColorTransFormのコードがクリップボードに入ります
*/
[SWF(width="465", height="465", backgroundColor="0xFFFFFF", frameRate="30")]
public class Colortest extends Sprite
{
private var _rect:Sprite = new Sprite();
private var rslide:HUISlider;
private var gslide:HUISlider;
private var bslide:HUISlider;
private var rlabel:Label;
private var glabel:Label;
private var blabel:Label;
public function Colortest()
{
init();
settingDisplay();
}
private function init():void {
_rect.graphics.beginFill(0x000000);
_rect.graphics.drawRect(0,0,100,100);
_rect.graphics.endFill();
rslide = new HUISlider(this,150,300,"R",slideHandler);
gslide = new HUISlider(this,150,340,"G",slideHandler);
bslide = new HUISlider(this,150,380,"B",slideHandler);
rlabel = new Label(this,220,280,"0");
glabel = new Label(this,220,320,"0");
blabel = new Label(this,220,360,"0");
var _button:PushButton = new PushButton(this, 185,420,"CopyClip",_clickHandler);
}
private function settingDisplay():void {
addChild(_rect);
_rect.x = 464/2 - _rect.width/2;
_rect.y = 100;
}
private function slideHandler(event:Event):void {
_rect.transform.colorTransform = new ColorTransform(1,1,1,1,rslide.value*2.55,gslide.value*2.55,bslide.value*2.55,1);
rlabel.text = String(int(rslide.value*2.55));
glabel.text = String(int(gslide.value*2.55));
blabel.text = String(int(bslide.value*2.55));
}
private function _clickHandler(event:MouseEvent):void {
System.setClipboard("mc.colorTransform = new ColorTransform(1,1,1,1,"+rlabel.text+","+glabel.text+","+blabel.text+",1);");
}
}
}