'MXAdvancedDataGridItemRenderer mouse over 시 배경 않보이게'에 해당되는 글 1건

  1. 2013.04.25 MXAdvancedDataGridItemRenderer mouse over 시 배경 않보이게
00.Flex,Flash,ActionScript2013. 4. 25. 15:54
반응형

<?xml version="1.0" encoding="utf-8"?>
<s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
          xmlns:s="library://ns.adobe.com/flex/spark"
          xmlns:mx="library://ns.adobe.com/flex/mx"
          focusEnabled="true"
          autoDrawBackground="false"> <-- 마우스 오버시 백그라운드 
 <fx:Script>
  <![CDATA[
   import mx.controls.AdvancedDataGrid;
   import mx.controls.advancedDataGridClasses.AdvancedDataGridListData;
   
   private const NORMALCY_COLOR:uint = 0x000000; // 0:정상(검정)
   private const PROBLEM_COLOR:uint = 0xFF0000; // 1:장치이상(빨강)
   private const INSPECTION_COLOR:uint = 0xFFFF00; // 2:점검(노랑)
   private const WARNING_COLOR:uint = 0xFF9900; // 3:경고(주황)
   private const DANGER_COLOR:uint = 0xFF0000; // 4:위험(빨강)
   
   private var strData:String;
   private var strDataError:String;
   
   override public function set data(value:Object) : void {
//    super.data = value;
    var arryStr:Array;
    if(value != null){
     
     var tmpStr:String  = (value[AdvancedDataGridListData(listData).dataField]) as String;
     arryStr = tmpStr.split("/");
     if(arryStr.length > 1){

      itemLabel.text = arryStr[0] as String;
      itemLabel.setStyle("color",getTLDS_TC_Color(arryStr[1]));
      
      strData = arryStr[0] as String;
      strDataError= arryStr[1] as String;
      itemLabel.addEventListener(MouseEvent.ROLL_OVER,overToolTip);
     }
    }
   }
   
   private function overToolTip(event:Event):void{
    this.toolTip = "[측정값:"+this.strData+"] [상태:"+getTLDS_TC_ErrorMsg(strDataError)+"]";
   }
   
   
   private function getTLDS_TC_Color(val:String):* {
    var rt:uint = 0x000000;
 
    //0:정상, 1:장치이상, 2:점검, 3:경고, 4:위험
    switch(val) {
     case "0": rt = 0x000000; break; //정상 검정  0x000000
     case "1": rt = 0xFF0000; break; //에러 빨강
     case "2": rt = 0xFFFF00; break; //주의 노랑
     case "3": rt = 0xFF9900; break; //경고 주황
     case "4": rt = 0xFF0000; break; //에러 빨강
    }
    return rt;
   }
   
   private function getTLDS_TC_ErrorMsg(val:String):String {
    var rtnStr:String = "";
    
    //0:정상, 1:장치이상, 2:점검, 3:경고, 4:위험
    switch(val) {
     case "0": rtnStr = "정상"; break; //정상 검정  0x000000
     case "1": rtnStr = "에러"; break; //에러 빨강
     case "2": rtnStr = "주의"; break; //주의 노랑
     case "3": rtnStr = "경고"; break; //경고 주황
     case "4": rtnStr = "에러"; break; //에러 빨강
    }
    return rtnStr;
   }
  ]]>
 </fx:Script>
 
 <s:Label id="itemLabel" text="" left="2" right="2" verticalCenter="0" backgroundAlpha="0"/> <-- 여기도...(랜더러로 만들지 않고 그냥 컴포넌트로 만들면 이부분만 처리해주면됨... 랜더러로 만드려면 위에 부분에 처리해줘야 함..

1시간 삽질후~~


</s:MXAdvancedDataGridItemRenderer>

 

Posted by 1010