IT기술/Flex

flex 10 HSlider를 이용한 RGB color test

dobbby 2008. 11. 20. 16:42
반응형



HSliderTest.mxml
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
 <mx:Script>
  <![CDATA[
   [Bindable]var rv:int;
   [Bindable]var gv:int;
   [Bindable]var bv:int;
   [Bindable]var rv1:int;
   [Bindable]var gv1:int;
   [Bindable]var color:int;
   function changed():void{
    rv = r.value;
    gv = g.value;
    bv = b.value;
    rv1 = rv << 16;
    gv1 = gv << 8;
    color = rv1 | gv1 | bv;
   }
  ]]>
 </mx:Script>
 <mx:Panel width="310" height="138" layout="absolute" horizontalCenter="0" verticalCenter="0" title="RGB color Test" backgroundColor="{color}">
  <mx:HSlider x="10" y="10" minimum="0" maximum="255" id="r" enabled="true" liveDragging="true" change="changed()"/>
  <mx:HSlider x="10" y="36" minimum="0" maximum="255" id="g" enabled="true" liveDragging="true" change="changed()"/>
  <mx:HSlider x="10" y="62" minimum="0" maximum="255" id="b" enabled="true" liveDragging="true" change="changed()"/>
  <mx:Label x="249" y="10" text="{rv}"/>
  <mx:Label x="249" y="36" text="{gv}"/>
  <mx:Label x="249" y="62" text="{bv}"/>
  <mx:Label x="195" y="10" text="red" color="#FF0000" alpha="1.0" fontFamily="Arial" fontWeight="bold" textDecoration="normal" fontStyle="normal"/>
  <mx:Label x="195" y="36" text="green" color="#00FF00" fontWeight="bold"/>
  <mx:Label x="195" y="62" text="blue" color="#0000FF" fontWeight="bold"/>
 </mx:Panel>
 
</mx:Application>
반응형