I'm building a little tool that lets user to place some geometric figures on screen and then move them around and change their properties. I'm quite new to as3/flex.
Figures are represented as objects in as3. So we've got Circle, Triangle, Rectangle classes with different properties.
What I like to do is to display some kind of "object inspector" when user selects a figure. This inspector window would resemble similar thing found in many IDEs.
Now the question is: Is it possible to take advantage from as3 [Inspectable] tag to obtain list of properties and enable changing them at runtime?
If it's not possible then how would you approach this problem without writing type specific code to edit each object?
Edit:
Just to clarify. Consider this example:
public class Shape { /* ... */ }
public class Triangle extends Shape {
public var a:Number;
public var h:Number;
//...
}
public class Circle extends Shape {
public var r:Number;
public var name:String;
//...
}
I want to give the user an ability to edit a, h from Triangle and r, name from Circle.
From what I imagine now, I could follow two paths:
Make
TriangleandCircleimplementIMyInspectableand write customgetProperties():Dictionary,getProperty(name:String):ObjectandsetProperty(name:String, value:Object):voidmethods for each type. This would involve utterly unelegant switch-spaghetti.I forgot when I was typing the solution number one. :(