The parent will be pulling the data from the DB and passing the data to each instance of the component to display.
The array of data in each component would routinely carry 30-40 items, but could have 50+ items on occasion. --- In [email protected], Alex Harui <aha...@...> wrote: > > The definition gets loaded once, 20 instances are created and 20 copies of > any of those instance's sub objects, etc. Usually that's small, but if you > have a lot of sub objects or a lot of properties or really big properties > like large arrays and bitmaps, then 20 instances can eat a lot of memory. > > Usually, for good modular design, the parent app or some "outside' thing > provides data (from the server, or a set of children) to a container and > logic in the container does the layout. > > Alex Harui > Flex SDK Developer > Adobe Systems Inc.<http://www.adobe.com/> > Blog: http://blogs.adobe.com/aharui > > From: [email protected] [mailto:[email protected]] On > Behalf Of jmfillman > Sent: Friday, September 04, 2009 12:28 PM > To: [email protected] > Subject: [flexcoders] Re: Coding Best Practices/Accessing Using External AS > > > > 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]<mailto:flexcoders%40yahoogroups.com>, > "ag_rcuren" <robert.vancuren.jr@> 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]<mailto:flexcoders%40yahoogroups.com>, > > "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. > > > > > >

