Assuming the locations are all in some data structure, i'd say keep that
structure and just iterate through each item and draw them on a single
canvas using the Graphics class/object.  Then register a mouse listener for
the entire canvas and calculate which container you clicked on based on the
x and y coordinates of the mouse event.  If the data structure is sorted
this should be a fast enough function.  This solution could have problems
with containers are constantly moving and overlap.  MouseOver graphics
representations could be done by actually putting a new uicomponent over the
container so that you don't have to draw on the canvas as much.  Really this
solution relies on you being able to index and search the data effectively
in any way the application needs.  If I'm not the right direction but
missing something I'll be happy to elaborate on any holes in my idea.

- Dan

On 2/1/07, arcencie1978 <[EMAIL PROTECTED]> wrote:

  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.........

Reply via email to