It depends.
Drawing into the graphics layer is fast and lightweight, but you can't manipulate the rectangles later (they've been painted). Using sub objects is like putting up panels of color. They can be moved, deleted, sized, etc. Don't forget to clear() the graphics layer before drawing ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of arpan srivastava Sent: Thursday, November 30, 2006 11:51 PM To: Flex Coders; Flex Components Subject: [flexcomponents] correct way to create rectangles ? Hi, I have to draw 5 rectangle inside a class extending UIComponent. I have done this : // Draw first base rectangle g.beginFill(baseRectColor1); g.drawRect(0,baseY,bRW1,baseRectHeight); g.endFill(); // Draw second base rectangle g.beginFill(baseRectColor2); g.drawRect(bRW1,baseY,bRW2,baseRectHeight); g.endFill(); // Draw third base rectangle g.beginFill(baseRectColor3); g.drawRect(bRW2 + bRW1,baseY,bRW3,baseRectHeight); g.endFill(); is this approach ok or should I create new sprite object for each rectangle and add it to the class. ? ________________________________ Everyone is raving about the all-new Yahoo! Mail beta. <http://us.rd.yahoo.com/evt=42297/*http:/advision.webevents.yahoo.com/ma ilbeta>
