Hi Ganaraj,

Thanks for replying.

Your solution seems more better. Please provide me the complete
example if you can.
And again, suppose i want to get the color(change) dynamically,
suppose from a colorpicker selected value, how I will set for
colortransform?(Means, var ct:ColorTransform = new ColorTransform
(1,1,1,1,A,B,C,D); How will i set the values of var. A,B,C,D
dynamically? )

Thanks,

Paritosh

On Feb 14, 10:57 am, ganaraj p r <[email protected]> wrote:
> If all you need to do is change the color ( and dont need to retrieve the
> values) then
> This peice of code will change the color of the graphics you have drawn in
> uicomp from any color to red.
>
> var ct:ColorTransform = new ColorTransform(1,1,1,1,255,-255,-255,0);
> uicomp.transform.colorTransform = ct;
>
> To change from any color to green:
>
> var ct:ColorTransform = new ColorTransform(1,1,1,1,-255,255,-255,0);
> uicomp.transform.colorTransform = ct;
>
> Any color to blue:
> var ct:ColorTransform = new ColorTransform(1,1,1,1,-255,-255,255,0);
> uicomp.transform.colorTransform = ct;
>
> I could also provide a complete example if you want.
>
> On Fri, Feb 13, 2009 at 6:22 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
>
> --
> Regards,
> Ganaraj P R
--~--~---------~--~----~------------~-------~--~----~
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