I don'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'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 <<a href="mailto:gilad.parann.nissany@g.ho.st">gilad.parann.nissany@g.ho.st</a>> 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 Parann-Nissany<br><br>----- Original Message -----<br>From: "Max Carlson" <<a href="mailto:max@openlaszlo.org" target="_blank">max@openlaszlo.org</a>><br>
</div><div><div></div><div class="Wj3C7c">To: "Gilad Parann-Nissany" <<a href="mailto:gilad.parann.nissany@g.ho.st" target="_blank">gilad.parann.nissany@g.ho.st</a>><br>Cc: "P T Withington" <<a href="mailto:ptw@laszlosystems.com" target="_blank">ptw@laszlosystems.com</a>>, "Max Carlson" <<a href="mailto:max@laszlosystems.com" target="_blank">max@laszlosystems.com</a>>, "laszlo-user" <<a href="mailto:laszlo-user@openlaszlo.org" target="_blank">laszlo-user@openlaszlo.org</a>>, "Ammar Tamazi" <<a href="mailto:Ammar.Tazami@corp.G.ho.st" target="_blank">Ammar.Tazami@corp.G.ho.st</a>>, "Elias Khalil" <<a href="mailto:Elias.Khalil@corp.G.ho.st" target="_blank">Elias.Khalil@corp.G.ho.st</a>>, "Lou Iorio" <<a href="mailto:liorio@laszlosystems.com" target="_blank">liorio@laszlosystems.com</a>><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'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" <<a href="mailto:max@openlaszlo.org" target="_blank">max@openlaszlo.org</a>><br>> To: "P T Withington" <<a href="mailto:ptw@laszlosystems.com" target="_blank">ptw@laszlosystems.com</a>><br>
> Cc: "Gilad Parann-Nissany" <<a href="mailto:gilad.parann.nissany@g.ho.st" target="_blank">gilad.parann.nissany@g.ho.st</a>>, "Max Carlson" <br>> <<a href="mailto:max@laszlosystems.com" target="_blank">max@laszlosystems.com</a>>, "laszlo-user" <<a href="mailto:laszlo-user@openlaszlo.org" target="_blank">laszlo-user@openlaszlo.org</a>>, <br>
> "Ammar Tamazi" <<a href="mailto:Ammar.Tazami@corp.G.ho.st" target="_blank">Ammar.Tazami@corp.G.ho.st</a>>, "Elias Khalil" <br>> <<a href="mailto:Elias.Khalil@corp.G.ho.st" target="_blank">Elias.Khalil@corp.G.ho.st</a>>, "Lou Iorio" <<a href="mailto:liorio@laszlosystems.com" target="_blank">liorio@laszlosystems.com</a>><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></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>