I have a series of component canvas containers that have children added and updated based on data in an ArrayCollection. The logic for the layout of the children in the container is identical for each canvas.
What I am struggling with is where to put the logic for the layout. If I put it inside the custom canvas container, I'm loading all this code each time I add the custom canvas container to the parent application, and there could be 20+ canvas containers added to the application. If I leave the layout logic in the parent container, then the layout for each canvas occurs in sequential order as I loop through all the canvas containers. I need the layout logic to run simultaneous and independantly for each canvas. So the question is, how do I externalize my layout logic so each container can use it, and not have the code internal to the component? What is the best practice? The canvas container has to pass an Array of data to the script and it will need to add and update children within the canvas container. To may way of thinking, each container shouldn't contain the same 400 lines of layout logic code. Instead, each instance of the container should be able to call the code, which is only loaded into the application 1 time. That seem's like the efficient way to go, but I'm not sure how to do this or if it's the right way to do it. I'm using Flex 3.

