[Laszlo-user] Understanding Flash memory usage when using Laszlo
Gilad Parann-Nissany
gilad.parann.nissany at g.ho.st
Mon Apr 21 01:28:20 PDT 2008
Hi
Thank you, very helpful. Could you also provide a code example or suggestion for the following situation:
- we are creating several views that have 1 resource (an SWF image)
- we wish the cached bitmap of the SWF resource to be calculated only once, and then the result to be reused in these several views
- goal is to save CPU time and memory consumption of the bitmap calculation
Any ideas?
Thanks
Gilad
Gilad Parann-Nissany
----- Original Message -----
From: "P T Withington" <ptw at laszlosystems.com>
To: "Gilad Parann-Nissany" <gilad.parann.nissany at g.ho.st>
Cc: "Henry Minsky" <henry.minsky at gmail.com>, "Max Carlson" <max at openlaszlo.org>, "Ammar Tamazi" <Ammar.Tazami at corp.g.ho.st>, "laszlo-user" <laszlo-user at openlaszlo.org>, "Max Carlson" <max at laszlosystems.com>, "Elias Khalil" <Elias.Khalil at corp.g.ho.st>, "Lou Iorio" <liorio at laszlosystems.com>
Sent: Sunday, April 20, 2008 5:15:33 AM (GMT-0800) America/Los_Angeles
Subject: Re: [Laszlo-user] Understanding Flash memory usage when using Laszlo
On 2008-04-20, at 06:13 EDT, Gilad Parann-Nissany wrote:
> 2. In general how would we write ActionScript code in an OL method ?
>
> any ideas? sugegstions? code examples are requested especially.
Our script is a superset of ActionScript. Whatever you want to write
in ActionScript, you can write in Javascript, which you can write in
an OL method. If you want to call a built-in ActionScript function,
you simply call it. The only thing you would want to take care about
is that your application will then be non-portable. Here is an
example of some code that calls into either the DHTML or SWF runtime,
depending on which platform it is compiled for. This sample comes
from the LFC kernel, it is the platform-specific implementation of a
portable LFC API:
if ($js1) {
var why;
if(window.XMLHttpRequest) {
try {
this.socket = new XMLHttpRequest();
} catch(e) {
why = e;
}
} else if(window.ActiveXObject) {
try {
this.socket = new ActiveXObject("Msxml2.XMLHTTP");
} catch(e) {
why = e;
try {
this.socket = new
ActiveXObject("Microsoft.XMLHTTP");
} catch(e) {
why = e;
}
}
}
} else if ($as2) {
// We'll instantiate a LoadVars object when needed, for
Flash runtime
this.socket = new LoadVars();
this.returnval = new LoadVars();
// callback from Flash LoadVars.sendAndLoad()
this.returnval.onData = this.flashOnLoadHandler;
} else {
Debug.error("Unsupported platform");
}
$js1 and $as2 are commpile-time constants that are defined for the SWF
and DHTML runtimes. The compiler will optimize away the if branches
that are not applicable.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20080421/5aa28ca1/attachment.html
More information about the Laszlo-user
mailing list