<html><head><style type='text/css'>body { font-family: 'Verdana'; font-size: 10pt; color: #000000}</style></head><body>Hi<br><br>We are on Flash 8 so that is OK.<br><br>What if I want to create the bitmap cache once and then use it several times? In detail the use case is as follows:<br><ul><li>we have several views showing essentially the same resource</li><li>we would like to create the bitmap cache the first time (the first view)</li><li>reuse that same bitmap cache in the 2nd and subsequent views</li></ul>Any chance? code samples?<br><br>Thanks<br>Gilad<br><br>Gilad Parann-Nissany<br><br>----- Original Message -----<br>From: "Max Carlson" <max@openlaszlo.org><br>To: "Gilad Parann-Nissany" <gilad.parann.nissany@g.ho.st><br>Cc: "P T Withington" <ptw@laszlosystems.com>, "Max Carlson" <max@laszlosystems.com>, "laszlo-user" <laszlo-user@openlaszlo.org>, "Ammar Tamazi" <Ammar.Tazami@corp.G.ho.st>, "Elias Khalil" <Elias.Khalil@corp.G.ho.st>, "Lou Iorio" <liorio@laszlosystems.com><br>Sent: Monday, April 21, 2008 9:13:55 PM (GMT+0200) Auto-Detected<br>Subject: Re: Understanding Flash memory usage when using Laszlo<br><br>If you want to turn on bitmap caching via actionscript, you can see an <br>example in the drawview source:<br>http://svn.openlaszlo.org/openlaszlo/trunk/lps/components/extensions/drawview.lzx<br><br>e.g.:<br>var context = this.getMCRef();<br>context.cacheAsBitmap = true/false<br><br>This will work with any view, provided you're running flash 8 or greater.<br><br>If you find yourself doing this a lot, please file a bug and we can add <br>a more formal API to view for you. Note that the more actionscript you <br>add using this technique, the less your app will work in other runtimes...<br><br>All drawviews have cacheBitmap on by default. If you want to <br>experiment, you can try setting the drawview's cachebitmap attribute to <br>false.<br><br>Gilad Parann-Nissany wrote:<br>> Thank you for the input. Could you give us concrete code examples of:<br>> <br>> 1. calling ActionScript directly in our OL code<br>> <br>> 2. using drawview (or any other technique) to create a bitmap cache of <br>> our SWFs. Note: we can limit ourselves to "simple views' (views that do <br>> not nest other views) as a first step if necessary.<br>> <br>> Gilad<br>> <br>> <br>> <br>> Gilad Parann-Nissany<br>> <br>> ----- Original Message -----<br>> From: "Max Carlson" <max@openlaszlo.org><br>> To: "P T Withington" <ptw@laszlosystems.com><br>> Cc: "Gilad Parann-Nissany" <gilad.parann.nissany@g.ho.st>, "Max Carlson" <br>> <max@laszlosystems.com>, "laszlo-user" <laszlo-user@openlaszlo.org>, <br>> "Ammar Tamazi" <Ammar.Tazami@corp.G.ho.st>, "Elias Khalil" <br>> <Elias.Khalil@corp.G.ho.st>, "Lou Iorio" <liorio@laszlosystems.com><br>> Sent: Thursday, April 17, 2008 7:18:24 PM (GMT+0200) Auto-Detected<br>> Subject: Re: Understanding Flash memory usage when using Laszlo<br>> <br>> <br>> <br>> P T Withington wrote:<br>> > On 2008-04-17, at 09:12 EDT, Gilad Parann-Nissany wrote:<br>> >> Hi<br>> >><br>> >> With the help from this forum we have been making progress<br>> >> understanding our memory usage. See the separate thread: [Laszlo-user]<br>> >> Understanding memory analysis when using _LzDebug.whyAlive()<br>> >><br>> >> We're now at the point were we see that the "smoots" taken up by<br>> >> Laszlo objects are not all of our memory usage. It seems a large part<br>> >> (large percentage of total RAM usage, maybe even more than 50%) may be<br>> >> used elsewhere, perhaps in the Flash objects that are "underneath" the<br>> >> Laszlo objects.<br>> >><br>> >> Questions:<br>> >><br>> >> 1. Is there any tool or technique that allows us to analyze exactly<br>> >> how this memory is being used by Flash? ("underneath" the laszlo<br>> >> objects, I mean)<br>> ><br>> > I am not aware of such a tool. There may be a tool provided by Adobe.<br>> <br>> Actually, this will be a nice benefit from the move to swf9. Flex<br>> builder (and presumably fdb) have profiling tools that can show this<br>> kind of memory usage.<br>> <br>> >> 2. Are there any guidelines to help us optimize this Flash part of<br>> >> our memory usage?<br>> >> 3. More generally is there any way to use Flash-specific<br>> >> optimization techniques (going to the ActionScript where necessary).<br>> >> We know that in pure Flash there are several optimization techniques;<br>> >> the following points are examples of things we wish to try<br>> >> 4. Can we in general call pieces of ActionScript from Laszlo script?<br>> ><br>> > Yes. The OL compiler does not prevent you from doing that, but neither<br>> > is it supported.<br>> ><br>> >> 5. Bitmap caching:<br>> >><br>> >><br>> >> • SWF resources can be translated once into bitmaps (on the<br>> >> client side) and cached<br>> >> • you probably know this is known as bitmap caching.<br>> >> • Then the bitmaps are used repeatedly instead of rendering the<br>> >> SWF objects repeatedly.<br>> >> • Can we do Bitmap Caching for all those vector graphics which<br>> >> do not change frequently (from Laszlo, but possibly with specific<br>> >> usage of Actionscript if necessary)<br>> ><br>> > I believe Max (cc-ed) has experimented with this. There may even be<br>> > support in LZX for it.<br>> <br>> We do have support for this in drawview. We can experiment with adding<br>> support for vector resources as well. There seemed to be side effects<br>> for things with nested views, for example.<br>> <br>> >> 6.<br>> >> Garbage collection: we would like to trigger the Flash garbage<br>> >> collection just to test what is going on (as a test not permanent<br>> >> change). Any way for us to do this?<br>> ><br>> > I am not aware of a programmatic way of doing that. In most browsers,<br>> > if you minimize the window the app is running in the Flash GC will run.<br>> ><br>> > Again, there are probably tools provided by Adobe for these purposes,<br>> > but I have not used them. There are probably more tools in the open<br>> > source Flex compiler, so the swf9 runtime should be easier to measure<br>> > and tune in this respect.<br>> <br>> -- <br>> Regards,<br>> Max Carlson<br>> OpenLaszlo.org<br>> <br><br>-- <br>Regards,<br>Max Carlson<br>OpenLaszlo.org<br></body></html>