PDA

View Full Version : Change color of lines drawn with the graphics class


sixtyfootersdude
08-05-2008, 08:13 PM
Hi all,

I am drawing several lines using the graphics class. Before I draw the line I set the color to be grey. Later I want to make the box blue. I could not find anyway that I could change the color of the lines. Any ideas?

think that I will just have to kill them and redraw (seems slow).


boxLine.graphics.lineStyle(1,Colors.grey);
boxLine.graphics.moveTo(userName.x,userName.y);
boxLine.graphics.lineTo(userName.x,post.y+post.hei ght);

Jim Freer
08-06-2008, 02:23 AM
Precede your code with this:


boxLine.graphics.clear();


It's slow, but thankfully our eyes are really slow so the frame rates can be low and the computers are really fast.

If you have performance problems other techniques might be available, like building pre-built bitmaps for each of the different colors. That can be a problem in some situations. but sometimes compromises must be made.

MSFX
08-06-2008, 09:30 AM
lol woot :p

sixtyfootersdude
08-06-2008, 12:45 PM
Thanks Jim that is what I thought I would need to do. Seems like a bad design overall but I guess that it has to store less stuff.