tags:

views:

124

answers:

1

When using dojox.av.FLVideo widget, I have encountered a problem where I can't destroy the widget manually. In simple logic:

1st AJAX call [Retrieves a partial page A with video]

var videoDiv = document.createElement('div');
videoDiv.id = "vid";
mainContent.appendChild(videoDiv);
var newVideo = new dojox.av.FLVideo({initialVolume:.7, mediaUrl:'video/sample.flv', autoPlay:true, isDebug:true}, "vid");
//video plays and everything looks fine

2nd AJAX call [Get another partial page B to replace the video]

var oldVideo = dijit.byId('vid');
oldVideo.destroy(); //should destroy this widget but doesn't

For some reason this widget is not destroyed, causing a problem because by the time we go back to perform AJAX call and try to page A and video again, it throws the id already exists exception. I also tried other funcions such us destroyRecursive(), disconnect() but none of them worked, does anyone know where the problem is?

Cheers

Peter

A: 

Try this:

var oldVideo = dijit.byId('vid');

oldVideo.destroy();

delete oldVideo;

GoinOff
Thank you for the suggestion. I tried it out and the problem persists. By looking at Firebug and setting breakpoints in javascript, it seems to me that this video widget is not affected at all after these two lines of code:oldVideo.destroy();delete oldVideo;Peter
PeterYunZhang
Peter,I had a case where destroy() didn't seem to work and this did (destroyRecursive(true)):if (legend != undefined) { legend.destroyRecursive(true);} See if oldVideo.destroyRecursive(true) works for you.
GoinOff
@GoinOff Unfortunately I couldn't get it working, I have filed a bug report. The link is bugs.dojotoolkit.org/ticket/9887 as @peller commented on my original post.Either way thank you for your help.CheersPeter
PeterYunZhang