カラーピッカーを使った場合、hexValueを使ってRGBへ
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | package{ import flash.display.*; import flash.events.*; import flash.text.*; import fl.controls.*; public class ColorPickerClass extends Sprite{ private var _ColorPicker:ColorPicker = new ColorPicker(); private var resultTXT0:TextField = new TextField(); private var resultTXT1:TextField = new TextField(); public function ColorPickerClass(){ _ColorPicker.addEventListener(Event.CHANGE, function(){ resultTXT0.text = "_ColorPicker.selectedColor: " + String(_ColorPicker.selectedColor); resultTXT1.text = '"0x"+String(_ColorPicker.hexValue): '+ "0x"+String(_ColorPicker.hexValue); }); addChild(_ColorPicker); addChild(resultTXT0); addChild(resultTXT1); resultTXT0.x = _ColorPicker.width + 5; resultTXT0.autoSize = TextFieldAutoSize.LEFT; resultTXT1.x = resultTXT0.x; resultTXT1.y = resultTXT0.height + 10; resultTXT1.autoSize = TextFieldAutoSize.LEFT; } } } |