Also make sure you are calling graphics.clear() before re-drawing all of
your graphic commands.

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Eric Cooper
Sent: Monday, April 14, 2008 9:23 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: graphics object seems to degrade performance

 

I am experiencing performance issues similar to those described in this
thread. By way of 
background, I am working on a geometry tool that allows the user to
create points, line 
segments, circles and polygons, to move then about and to create
constraints between 
them. I am new to ActionScript/Flex/Flash and, perhaps, tainted by other

languages/frameworks. So, I have subclasses Canvas and it is responsible
of rendering all 
the geometric shapes. In other words, my geometric shapes do extend
DisplayObject and 
are *not* in the display list.

As I add more and more shapes (i.e., more than 10), I see that drag
performance degrades 
rapidly. I am considering adopting Alex's suggestion: generating a
bitmap at the start of a 
drag (such that the bitmap contains all shapes that are not about to be
dragged), clearing 
the graphics object, blitting the bitmap and then drawing the object(s)
being dragged.

I am wondering, though, if I would get this for "free" if I used
DisplayObject and the built-
in drag events. I am also wondering, if I am saving that much in terms
of memory and 
speed, by "rolling my own" as it were.

Thanks,
-Eric

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> It will help some, but you'll still end up with 500,000 vectors spread
> thorough 1000 overlaid shapes.
> 
> 
> 
> In order to handle undo, you would track the vectors in your own array
> of points and take snapshots as I suggested. I wouldn't even encode as
> png, all you need is one extra bitmapdata.

 

Reply via email to