[Laszlo-dev] destroy issues

Denis Bohm denis at fireflydesign.com
Wed Apr 12 10:58:00 EDT 2006


I had the same problem.  If the view is destroyed before the resource  
has finished loading it clogs up the load queue.  I put this in the  
view that is loading the resource and it seemed to work around the  
problem:

         <method name="destroy">
             var movieClipLoader = this["movieClipLoader"];
             if (movieClipLoader) {
                 movieClipLoader.unloadClip(this.source);
             }
         </method>

I thought I had logged a bug in JIRA a while ago, but I can't find  
anything so I just did now as LPP-1952.

On Apr 12, 2006, at 3:51 AM, P T Withington wrote:

> Instantiation is asynchronous.  You are likely calling destroy before
> the view has completed initializing.  Try waiting for the view's
> oninit event before you destroy.
>
> On 2006-04-12, at 05:37 EDT, Bastien HUBERT wrote:
>
>> I'm having issues using the destroy() method on views.
>>
>> I'm pretty new to laszlo and i don't know if this problem has already
>> been reported.
>>
>> If i destroy views too quickly, views won't display anymore and the
>> "evaluate" field of the laszlo debugger won't respond anymore.
>>
>> I made a little example showing this problem.
>>
>> <canvas debug="true">
>>     <debug width="800" height="600" />
>>     <button>Fast Destroy
>>         <method event="onclick">
>>         <![CDATA[
>>             var url = "http://flash-france.com/files/flash/menu/
>> FFmenu.swf";
>>
>>             for (var i = 0; i < 10; i++){
>>
>>                 if (screen.getAttribute("screenView")){
>>                     screen.screenView.destroy();
>>                 }
>>
>>                 screen.setAttribute("screenView", new LzView(screen,
>> {resource : url}));
>>             }
>>         ]]>
>>         </method>
>>     </button>
>>     <window id="screen" width="800" height="600" y="30" />
>> </canvas>
>>
>> If you try to click on the button, you will normally have nothing  
>> else
>> than a white screen and if you type "canvas" in the laszlo
>> debugger, you
>> won't have any response.
>>
>> An other test i made is removing the 'for loop', but if you try to
>> manually spam the button quick enough the same problem will happen,
>> and
>> the bigger the flash resource is in the view, the more frequent the
>> problem will occur.
>>
>> A last test i made was to remove the destroy instruction in the 'for
>> loop' and to modify the line constructing the new view as bellow:
>>
>>   for (var i = 0; i < 10; i++){
>>       screen.setAttribute("screenView", new LzView(screen,  
>> {resource :
>> url, y : i*10}));
>>   }
>>
>> Then, you will see the different views ten times, without crashing,
>> so i
>> concluded that the destroy method was really responsible for my
>> problem.
>>
>> In fact i need to use destroy() or something doing the same thing,
>> because i want to display alternatively based on user choice a normal
>> view containing flash resource or a component i made containing some
>> views, in the same window. Then, i have to destroy the previous
>> view to
>> display the new one. If you have any ideas which can help me without
>> using destroy(), you're welcome too !
>>
>> Bastien HUBERT
>>
>> _______________________________________________
>> Laszlo-dev mailing list
>> Laszlo-dev at openlaszlo.org
>> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>



More information about the Laszlo-dev mailing list