I am trying to create a visual repersentation of data I am
manipulating in Flex by means of an actionscript component.
Coming from a Flash background I think of this as adding a
"stage" to the main Flex application (where I will use the
Actionscript drawing API to to the repersentaion). However I am
having some problems understanding the best way to go about this in
Flex and was wondering if there was a best practice in with regard
I would be interested in any feedback to the above. If you
find the above far to vague I am very sorry! If you would like
specifics just let me know. It is not any particular aspect of the
code that is frustrating me. It is just that I would like to be
able to understand the best way to go about this.
Thank you for you time.
I know nothing about the best practices.
But I suggest you make a custom component extending the
Component add an on Resize event handler to resize and reposition
as needed. To this component, you can add Shapes and Sprites,
Bitmap Data and the like as needed to represent your data.
I do something similar but actually extend the Application
tag in a "code-behind" model approach.
The following code is adapted from the FB 3 help topic
"Animating objects". Search FB 3 help for "drawing", "circle",
Regarding your comments on the Flash stage, often when
working with pure graphics objects in Flex, you create a Sprite, do
your drawing in it, and then wrap it in a UIComponent, as seen in
the attached code.