달력

5

« 2025/5 »

  • 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
  • 30
  • 31

'cursor이미지변경'에 해당되는 글 1

  1. 2011.10.05 [Flex] CursorManager && Graphic..path..
2011. 10. 5. 14:49

[Flex] CursorManager && Graphic..path.. 공부/flex2011. 10. 5. 14:49


<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
      xmlns:s="library://ns.adobe.com/flex/spark"
      xmlns:mx="library://ns.adobe.com/flex/mx"
      creationComplete="eventInit()">
 <fx:Script>
  <![CDATA[
   import component.CGraphicBase;
   
   import mx.managers.CursorManagerPriority;
   import mx.managers.CursorManager;

   [Bindable]
   [Embed(source="img/tag.png")]
   public var customCursor:Class;
   private function eventInit():void{
        var oItem:Object = new Object();
        oItem.name = "testGraphic";
        oItem.today = new Date();
        //make Graphic
         var oGraphic:CGraphicBase = new CGraphicBase();
        oGraphic.graphicInfo = oItem;
        oGraphic.width =200;
        oGraphic.height = 100;
        oGraphic.x = 100;
        oGraphic.y = 100;
        oGraphic.color = 0xF19232;
        oGraphic.toolTip = oItem.name + "-" + oItem.today.toString();
        oGraphic.reFreshImage();
        oGraphic.addEventListener(MouseEvent.MOUSE_OVER,eventMouseOver);
        oGraphic.addEventListener(MouseEvent.MOUSE_OUT,eventMouseOut);
        bc.addElement(oGraphic);
   }
   private function eventMouseOver(event:MouseEvent):void{
        var oTarget:CGraphicBase = event.currentTarget as CGraphicBase;
        CursorManager.setCursor(customCursor, CursorManagerPriority.HIGH, 3, 2);
   }
   private function eventMouseOut(event:MouseEvent):void{
        var oTarget:CGraphicBase = event.currentTarget as CGraphicBase;
        CursorManager.removeAllCursors();
   }
  ]]>
 </fx:Script>
 <s:BorderContainer id="bc" width="100%" height="100%">
  
 </s:BorderContainer>
</s:Application>
 





CGraphicBase

<?xml version="1.0" encoding="utf-8"?>
<s:Graphic xmlns:fx="http://ns.adobe.com/mxml/2009"
     xmlns:s="library://ns.adobe.com/flex/spark"
     xmlns:mx="library://ns.adobe.com/flex/mx"
     xmlns:common="common.*">
 <fx:Script>
  <![CDATA[
   private var oInfo:Object;
   public function set graphicInfo(value:Object):void{
    oInfo = value;
   }
   public function get graphicInfo():Object{
    return oInfo;
   }
   public function set color(value:uint):void{
    ge.color = value;
   }
   public function set fillAlpha(value:Number):void{
    ge.alpha = value;
   }
   public function get fillAlpha():Number{
    return ge.alpha;
   }
   public function reFreshImage():void{
    btnPath.data = "M 0 0 L "+this.width.toString()+" 0 L "+this.width.toString()+" "+this.height.toString()+" L 0 "+this.height.toString()+ " L 0 0 ";
   }
  ]]>
 </fx:Script>
 <s:Path id="btnPath">        
  <s:fill>
   <s:LinearGradient rotation="90">
    <s:GradientEntry id="ge" color="#F7CB3C" alpha=".6"/>
   </s:LinearGradient>
  </s:fill>       
  <s:stroke>            
   <s:SolidColorStroke id="outline" alpha="1" color="{ge.color}" weight="1" />       
  </s:stroke>    
 </s:Path>
</s:Graphic>



:
Posted by 알 수 없는 사용자