I don&#39;t think that is possible. The bitmap cache is associated with a single movieclip, and a movieclip<br>cannot be the child of more than one parent movieclip.<br><br>It is possible, however to generate a bitmap and to copy it. We don&#39;t have any API for this in Laszlo,<br>
but the Flash 8 API does let you generate bitmaps from movieclips I believe. <br><br><br><div class="gmail_quote">On Sun, Apr 27, 2008 at 11:40 AM, Gilad Parann-Nissany &lt;<a href="mailto:gilad.parann.nissany@g.ho.st">gilad.parann.nissany@g.ho.st</a>&gt; wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div>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<div class="Ih2E3d"><br>Gilad<br><br>Gilad&nbsp;Parann-Nissany<br><br>----- Original Message -----<br>From: &quot;Max Carlson&quot; &lt;<a href="mailto:max@openlaszlo.org" target="_blank">max@openlaszlo.org</a>&gt;<br>
</div><div><div></div><div class="Wj3C7c">To: &quot;Gilad Parann-Nissany&quot; &lt;<a href="mailto:gilad.parann.nissany@g.ho.st" target="_blank">gilad.parann.nissany@g.ho.st</a>&gt;<br>Cc: &quot;P T Withington&quot; &lt;<a href="mailto:ptw@laszlosystems.com" target="_blank">ptw@laszlosystems.com</a>&gt;, &quot;Max Carlson&quot; &lt;<a href="mailto:max@laszlosystems.com" target="_blank">max@laszlosystems.com</a>&gt;, &quot;laszlo-user&quot; &lt;<a href="mailto:laszlo-user@openlaszlo.org" target="_blank">laszlo-user@openlaszlo.org</a>&gt;, &quot;Ammar Tamazi&quot; &lt;<a href="mailto:Ammar.Tazami@corp.G.ho.st" target="_blank">Ammar.Tazami@corp.G.ho.st</a>&gt;, &quot;Elias Khalil&quot; &lt;<a href="mailto:Elias.Khalil@corp.G.ho.st" target="_blank">Elias.Khalil@corp.G.ho.st</a>&gt;, &quot;Lou Iorio&quot; &lt;<a href="mailto:liorio@laszlosystems.com" target="_blank">liorio@laszlosystems.com</a>&gt;<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>
<a href="http://svn.openlaszlo.org/openlaszlo/trunk/lps/components/extensions/drawview.lzx" target="_blank">http://svn.openlaszlo.org/openlaszlo/trunk/lps/components/extensions/drawview.lzx</a><br><br>e.g.:<br>var context = this.getMCRef();<br>
context.cacheAsBitmap = true/false<br><br>This will work with any view, provided you&#39;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. &nbsp;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. &nbsp;If you want to <br>experiment, you can try setting the drawview&#39;s cachebitmap attribute to <br>
false.<br><br>Gilad Parann-Nissany wrote:<br>&gt; Thank you for the input. Could you give us concrete code examples of:<br>&gt; <br>&gt; 1. calling ActionScript directly in our OL code<br>&gt; <br>&gt; 2. using drawview (or any other technique) to create a bitmap cache of <br>
&gt; our SWFs. Note: we can limit ourselves to &quot;simple views&#39; (views that do <br>&gt; not nest other views) as a first step if necessary.<br>&gt; <br>&gt; Gilad<br>&gt; <br>&gt; <br>&gt; <br>&gt; Gilad Parann-Nissany<br>
&gt; <br>&gt; ----- Original Message -----<br>&gt; From: &quot;Max Carlson&quot; &lt;<a href="mailto:max@openlaszlo.org" target="_blank">max@openlaszlo.org</a>&gt;<br>&gt; To: &quot;P T Withington&quot; &lt;<a href="mailto:ptw@laszlosystems.com" target="_blank">ptw@laszlosystems.com</a>&gt;<br>
&gt; Cc: &quot;Gilad Parann-Nissany&quot; &lt;<a href="mailto:gilad.parann.nissany@g.ho.st" target="_blank">gilad.parann.nissany@g.ho.st</a>&gt;, &quot;Max Carlson&quot; <br>&gt; &lt;<a href="mailto:max@laszlosystems.com" target="_blank">max@laszlosystems.com</a>&gt;, &quot;laszlo-user&quot; &lt;<a href="mailto:laszlo-user@openlaszlo.org" target="_blank">laszlo-user@openlaszlo.org</a>&gt;, <br>
&gt; &quot;Ammar Tamazi&quot; &lt;<a href="mailto:Ammar.Tazami@corp.G.ho.st" target="_blank">Ammar.Tazami@corp.G.ho.st</a>&gt;, &quot;Elias Khalil&quot; <br>&gt; &lt;<a href="mailto:Elias.Khalil@corp.G.ho.st" target="_blank">Elias.Khalil@corp.G.ho.st</a>&gt;, &quot;Lou Iorio&quot; &lt;<a href="mailto:liorio@laszlosystems.com" target="_blank">liorio@laszlosystems.com</a>&gt;<br>
&gt; Sent: Thursday, April 17, 2008 7:18:24 PM (GMT+0200) Auto-Detected<br>&gt; Subject: Re: Understanding Flash memory usage when using Laszlo<br>&gt; <br>&gt; <br>&gt; <br>&gt; P T Withington wrote:<br>&gt; &nbsp;&gt; On 2008-04-17, at 09:12 EDT, Gilad Parann-Nissany wrote:<br>
&gt; &nbsp;&gt;&gt; Hi<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; With the help from this forum we have been making progress<br>&gt; &nbsp;&gt;&gt; understanding our memory usage. See the separate thread: [Laszlo-user]<br>&gt; &nbsp;&gt;&gt; Understanding memory analysis when using _LzDebug.whyAlive()<br>
&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; We&#39;re now at the point were we see that the &quot;smoots&quot; taken up by<br>&gt; &nbsp;&gt;&gt; Laszlo objects are not all of our memory usage. It seems a large part<br>&gt; &nbsp;&gt;&gt; (large percentage of total RAM usage, maybe even more than 50%) may be<br>
&gt; &nbsp;&gt;&gt; used elsewhere, perhaps in the Flash objects that are &quot;underneath&quot; the<br>&gt; &nbsp;&gt;&gt; Laszlo objects.<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; Questions:<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;1. Is there any tool or technique that allows us to analyze exactly<br>
&gt; &nbsp;&gt;&gt; how this memory is being used by Flash? (&quot;underneath&quot; the laszlo<br>&gt; &nbsp;&gt;&gt; objects, I mean)<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; I am not aware of such a tool. &nbsp;There may be a tool provided by Adobe.<br>
&gt; <br>&gt; Actually, this will be a nice benefit from the move to swf9. &nbsp;Flex<br>&gt; builder (and presumably fdb) have profiling tools that can show this<br>&gt; kind of memory usage.<br>&gt; <br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;2. Are there any guidelines to help us optimize this Flash part of<br>
&gt; &nbsp;&gt;&gt; our memory usage?<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;3. More generally is there any way to use Flash-specific<br>&gt; &nbsp;&gt;&gt; optimization techniques (going to the ActionScript where necessary).<br>&gt; &nbsp;&gt;&gt; We know that in pure Flash there are several optimization techniques;<br>
&gt; &nbsp;&gt;&gt; the following points are examples of things we wish to try<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;4. Can we in general call pieces of ActionScript from Laszlo script?<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; Yes. &nbsp;The OL compiler does not prevent you from doing that, but neither<br>
&gt; &nbsp;&gt; is it supported.<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;5. Bitmap caching:<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt;<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;• SWF resources can be translated once into bitmaps (on the<br>&gt; &nbsp;&gt;&gt; client side) and cached<br>
&gt; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;• you probably know this is known as bitmap caching.<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;• Then the bitmaps are used repeatedly instead of rendering the<br>&gt; &nbsp;&gt;&gt; SWF objects repeatedly.<br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp;• Can we do Bitmap Caching for all those vector graphics which<br>
&gt; &nbsp;&gt;&gt; do not change frequently (from Laszlo, but possibly with specific<br>&gt; &nbsp;&gt;&gt; usage of Actionscript if necessary)<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; I believe Max (cc-ed) has experimented with this. &nbsp;There may even be<br>
&gt; &nbsp;&gt; support in LZX for it.<br>&gt; <br>&gt; We do have support for this in drawview. &nbsp;We can experiment with adding<br>&gt; support for vector resources as well. &nbsp;There seemed to be side effects<br>&gt; for things with nested views, for example.<br>
&gt; <br>&gt; &nbsp;&gt;&gt; &nbsp; &nbsp;6.<br>&gt; &nbsp;&gt;&gt; Garbage collection: we would like to trigger the Flash garbage<br>&gt; &nbsp;&gt;&gt; collection just to test what is going on (as a test not permanent<br>&gt; &nbsp;&gt;&gt; change). Any way for us to do this?<br>
&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; I am not aware of a programmatic way of doing that. &nbsp;In most browsers,<br>&gt; &nbsp;&gt; if you minimize the window the app is running in the Flash GC will run.<br>&gt; &nbsp;&gt;<br>&gt; &nbsp;&gt; Again, there are probably tools provided by Adobe for these purposes,<br>
&gt; &nbsp;&gt; but I have not used them. &nbsp;There are probably more tools in the open<br>&gt; &nbsp;&gt; source Flex compiler, so the swf9 runtime should be easier to measure<br>&gt; &nbsp;&gt; and tune in this respect.<br>&gt; <br>&gt; -- <br>
&gt; Regards,<br>&gt; Max Carlson<br>&gt; OpenLaszlo.org<br>&gt; <br><br>-- <br>Regards,<br>Max Carlson<br>OpenLaszlo.org<br></div></div></div></blockquote></div><br><br clear="all"><br>-- <br>Henry Minsky<br>Software Architect<br>
<a href="mailto:hminsky@laszlosystems.com">hminsky@laszlosystems.com</a><br><br>