Can we identify individual sectors of a circle component uniquely in flex?

Posted by Angeline Aarthi on Stack Overflow See other posts from Stack Overflow or by Angeline Aarthi
Published on 2010-01-04T08:02:11Z Indexed on 2010/04/13 3:02 UTC
Read the original article Hit count: 349

Filed under:

I have a custom circle component in my application, which is divided into 3 sectors as of now.Can we uniquely identify each segments of this circle? I want to drag and drop text or images from another container to this circle component. But I want to place different images in the different sectors. Is it possible to distinguish the individual sectors of the circle component?

Here is my code:

    <mx:TabNavigator width="624" height="100%">

        <mx:VBox id="currQuote" label="Currents Quote" width="100%"> 

            <comp:MyCircle x1="175" y1="150" radius="150"/>
            <comp:MyCircle x1="175" y1="150" radius="120"/> 
            <comp:MyCircle x1="175" y1="150" radius="25"/>             
            <comp:MyLine x1="160" y1="122"/>    

        </mx:VBox>

        <mx:VBox label="Quote Comparison" width="100%"/>                       

        <mx:VBox label="Reports" width="100%"/>   

   </mx:TabNavigator>

Circle component:

 package components
 {
   import mx.core.UIComponent;

   public class MyCircle extends UIComponent
   {
        public var x1:int; 
          public var y1:int; 
          public var radius:int; 

          override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
         {          
        graphics.lineStyle(1, 0x000000);
        graphics.drawCircle(x1, y1, radius);    
         } 
      }
   } 

Line component:

 package components
 {
import mx.core.UIComponent;

public class MyLine extends UIComponent
{
    public var x1:int; 
              public var y1:int; 

    override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void 
    {           
        graphics.lineStyle(1, 0x000000);
        graphics.moveTo(100,0);
        graphics.lineTo(x1, y1); 
        graphics.moveTo(250,0);
        graphics.lineTo(185,120);
    } 
  }
}

Actually I want the circle to be divided into 6 sectors, but for now just divided it into 3 sectors. But is it possible to uniqulely identify the individual sectors of the circle so that I can drag different images or texts into those particular sectors?

© Stack Overflow or respective owner

Related posts about flex