I don't think that is possible. The bitmap cache is associated with a single
movieclip, and a movieclip
cannot be the child of more than one parent movieclip.

It is possible, however to generate a bitmap and to copy it. We don't have
any API for this in Laszlo,
but the Flash 8 API does let you generate bitmaps from movieclips I believe.



On Sun, Apr 27, 2008 at 11:40 AM, Gilad Parann-Nissany <
[EMAIL PROTECTED]> wrote:

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



-- 
Henry Minsky
Software Architect
[EMAIL PROTECTED]

Reply via email to