This content has been marked as final. Show 4 replies
I would just use the ActionScript drawing API together with your custom classes for the different shapes you will use. They can inherit from a base class that defines properties and methods common to all the shapes, upon which you can build for each shape's unique aspects.
Thanks Greg. I'd be really grateful if you could confirm the amount of effort I should expect to put in to implement this *correctly* :)
As suggested, I've subclassed UIComponent for my basic shape class and added a UITextField property for the text to be displayed on the shape, (this is something I was working on over the weekend).
I got this working by taking inspiration from the Flex source code for mx.controls.Button, (I'm actually an undergraduate Computer Science student and am concerned this may be quite a naive approach).
It does seems like I have reimplement a lot of code to let UITextField know the area in which it can / should display text... Am I doing something wrong or is this to be expected?
Hmmm... Now that I've thought about this a bit more, I'm wondering if you might be better off extending the Button class and as you hinted, use programmatic skins to render the shapes. That way you already have the capability to display text built in.
I don't really know how long it would take to implement this. It depends on your experience with object oriented and event programming, and with your ability to translate that to using ActionScript. That said, even without heavy experience, if your program is not that ambitious, it might now take long to start getting something working.
Thanks for your responses Greg. I guess both options are open then. Thanks to ActionScript being Open Source it's not taken too long to get something working as you say. I guess I'll continue with the approach I've taken so far for now, (extending UIComponent,) as subclassing, e.g. Button, may inherit properties, methods, events and styles that don't really make sense for my diagram element classes.