Yes, I have a custom canvas component. Currently, my layout logic is in the parent application, and has to perform the layout sequentially for the data relevant to each instance of the custom component. My concern was that FlashPlayer/AIR is loading the component X number of times and so the memory usage would quickly get out of hand. With your description, it only gets loaded once, but used multiple times, and that would work just fine. Thank you for the explanation!
--- In [email protected], "ag_rcuren" <robert.vancuren...@...> wrote: > > So if I am understanding you correctly you have built a custom component > already and you are just making many instances of it during the runtime of > your app? If this is the case it is fine to put the logic in the custom > canvas. Once you compile the code each time you add a new instance of the > component it will not be adding the 400 lines of code to your app over and > over. All of the components reference the same compiled code. Even if you are > loading modules once you load a module once the application is smart enough > to know that that code is already loaded into the app and does not reload all > of that code. > > Now if you are talking about 20 separate classes that all have the same code > copied and pasted (yikes) you would want to use a base class and extend from > that. > > > > --- In [email protected], "jmfillman" <jmfillman@> wrote: > > > > 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. > > >

