I have been working in Flex for about 3 months now. I am writing a geometry 
tool that allows user to create 
points, line segments, circle and polygons, as well as constraints between 
these objects (e.g., distance, angle, 
perpendicular, etc.). Initially, I created a (subclass of) 
ApplicationControlBar and (a subclass) of Canvas. Tools in 
the app control bar and objects (by which I mean geometric shapes) in the 
canvas.

My canvas listeners for Event.RENDER and then, provided it's been told that 
something has changed, calls its 
draw() method - which, essentially, loops through objects, drawing them to the 
graphics object - after having 
cleared the graphics object. Similarly, the canvas listeners for various 
MouseEvents and KeyboardEvents, and 
traverses the list of objects doing hit tests.

This was okay until I needed to render text (for distances and angles). 
Apparently there are ways around that - 
by rendering text to a bitmap and adding bitmap to graphics command stack 
(though I have yet to actually get 
this working). There are other concerns that I have about my approach thus far.

But switching over to a model where each geometric object is a Sprite or a 
Shape raises some questions, too.

Currently, I can highlight points, edges and angles of polygons are the mouse 
moves over them. I have no idea 
how I would accomplish this with Sprite or Shape, as neither appears to have a 
draw() or paint() method... Would 
I need to add Shapes for "selected look" for each point, line segment, etc. and 
toggle visible property 
appropriately? Is this something that skins might be used for? If so, how?

I realize that this is a somewhat open-ended question, and I am hesitant asking 
it. I have done a fair amount of 
reading (books, blogs, docs), but I think that I am missing something here. If 
you have pointers or advice, I 
would be most grateful.

Thanks.
-Eric

Reply via email to