Hi Kalpesh,

I completed the task by following your first answer. Clear and
regenerate. Hope we will get a better solution for this.

Thanks,

Paritosh

On Feb 13, 5:52 pm, Paritosh Bisi <[email protected]> wrote:
> Thanks Kalpesh for the codes,
>
> But my requirement is somewhat different.
> See, I have a canvas. I am creating an UIComponent. Then I am drawing
> a
> line using  uicomp.graphics.linestyle, uicomp.graphics.moveto and
> uicomp.graphics.lineto.and adding the uicomp to canvas.
>
> Then I am able to get the the object and clear it also.
>
> But for redrawing using some other color, I need to get the properties
> dynamically, for lineto and moveto. By hard coding I am able to do.
>
> {Repeating the question here - Suppose I have drawn  a line from
> (10,10) to
> (100,100), with black color. I want to change it to red. Is there any
> way to get the values ie (10,10) and (100,100) dynamically? }
>
> Thanks,
>
> Paritosh
>
> On Feb 13, 5:33 pm, "Kalpesh Mahida" <[email protected]>
> wrote:
>
> > Hi Paritosh,
>
> > Might this code can give you some idea about the implementation if you are
> > using a class to drawing the line
>
> > public class Drawline extends Canvas
> > {
> >         private var childCreated:Boolean = false; // flag will set true once
> > all children created in commitProperties()
>
> >         public function Drawline () {
> >                 super();
> >         }
> >         override protected function createChildren():void {
> >         super.createChildren();
> >         }
> >         protected override function updateDisplayList( unscaledWidth:Number,
> > unscaledHeight:Number ):void {
> >         super.updateDisplayList( unscaledWidth, unscaledHeight );
> >         }
>
> >         public function set LineColor( value:Number ):void {
> >                 this.removeAllChildren();
> >         this.graphics.clear();
> >                 drawMyLine( ColorCode );
> >                 // create all children again    
> >         }
>
> >         override protected function commitProperties():void{
> >                 super.commitProperties();
> >                 if ( childCreated == false ) {
> >                         // create all children
> >                         drawMyLine( ColorCode );
> >                         childCreated = true;
> >                 }
> >                 invalidateDisplayList();
> >         }
>
> >         private function drawMyLine( ColorCode ):void {
>
> >                 // Your Logic of Drawing Line
>
> >         }
>
> > }
>
> > Let me know if it helps you or you will find some better solutions
>
> > Kalpesh Mahida
>
> > -----Original Message-----
> > From: [email protected] [mailto:[email protected]] On
>
> > Behalf Of Paritosh Bisi
> > Sent: Friday, February 13, 2009 5:41 PM
> > To: Flex India Community
> > Subject: [flex_india:19233] Re: Changing color of graphics at run time.
>
> > Thanks Kalpesh,
>
> > Ya I can clear and redraw, but how will I get the attributes at run
> > time for redrawing? Suppose I have drawn  a line from (10,10) to
> > (100,100), with black color. I want to change it to red. Is there any
> > way to get the values ie (10,10) and (100,100) dynamically?
>
> > Thanks,
>
> > Paritosh
>
> > On Feb 13, 4:54 pm, "Kalpesh Mahida" <[email protected]>
> > wrote:
> > > Hi Pritosh,
>
> > > I think you can clear the line using graphics.clear(); and regenerate it
> > > again with desired color
>
> > > Let me know if it helps you or you will find some better solutions
>
> > > Kalpesh Mahida
>
> > > -----Original Message-----
> > > From: [email protected] [mailto:[email protected]] On
>
> > > Behalf Of Paritosh Bisi
> > > Sent: Friday, February 13, 2009 4:22 PM
> > > To: Flex India Community
> > > Subject: [flex_india:19222] Changing color of graphics at run time.
>
> > > Hi,
>
> > > I have a canvas, I am creating an UIComponent. Then I am drawing a
> > > line using  uicomp.graphics.linestyle, uicomp.graphics.moveto and
> > > uicomp.graphics.lineto. After adding the uicomp to canvas, is there
> > > any way to change the color that line?
>
> > > Thanks,
>
> > > Paritosh
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Flex 
India Community" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/flex_india?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to