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" <[EMAIL PROTECTED]> 
To: "Gilad Parann-Nissany" <[EMAIL PROTECTED]> 
Cc: "Henry Minsky" <[EMAIL PROTECTED]>, "Max Carlson" <[EMAIL PROTECTED]>, 
"Ammar Tamazi" <[EMAIL PROTECTED]>, "laszlo-user" <[email protected]>, 
"Max Carlson" <[EMAIL PROTECTED]>, "Elias Khalil" <[EMAIL PROTECTED]>, "Lou 
Iorio" <[EMAIL PROTECTED]> 
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. 


Reply via email to