I had a similar problem drawing dependency graphs. I've had the best
luck simply drawing them to a Graphics, adding them as children was too
expensive and couldn't keep up with the frame rate.
You'll probably want to create a spatial partitioning scheme so that you
can quickly determine mouseover/mousehits. I did something pretty
simple, just used a coarse version of the coordinates as a hash key to a
list of items in that cell.
-rg
________________________________
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Gordon Smith
Sent: Thursday, February 01, 2007 4:23 PM
To: [email protected]
Subject: RE: [flexcoders] What is the best way to draw about
10,000 to 15,000 rectangles?
> adding all of them to the display list takes so long and is
just too much
What kind of time are you seeing? I was able to add 10,000
UIComponents as children in about 10 seconds. And I was able to add
10,000 Sprites as "raw" children (using rawChildren.addChild()) in about
2 seconds. How fast do you need it to be?
- Gordon
________________________________
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of arcencie1978
Sent: Thursday, February 01, 2007 6:50 AM
To: [email protected]
Subject: [flexcoders] What is the best way to draw about 10,000
to 15,000 rectangles?
Hello folks,
I'm trying to put about 10,000 to 15,000 rectangles
in a stage.
And I'd like to know what could be the best way to do this..
Of course, I can just draw everything on the stage,
without having to make instances of a class,
which defines the way to draw them.
Yet the thing is that,
every rectangle,sized about 5~10 pixel width and 3 pixel height,
has to respond to events such as mouse over and mouse click
events..
So I've tried to make a cell class and made some 10,000
instances of
it
but adding all of them to the display list takes so long and is
just
too much....
Yet forgetting about making instances of this sort of class and
using something like BitmapData
doesn't give me any idea about how to register events to each
cell..
So is there anybody who has developed this sort of application?
By the way, the reason I have to draw these so many pieces is
because
each cell actually represents a container in the harbor and
there are
just so many of them and my client wants to put all of'em in the
application.........