Disposing of a swfUpload instance
I have a swfUpload instance that I want to make disapear after a succesful upload. I tried the destroy method but it caused a lot of javascript problems. So what I did is when the uploadSuccess event fires I get my div and set it's display to none. I then set the innerHTML of another div to show a thumbnail of the uploaded video. It works fine on every browser except internet explorer where it shows :
Message :
Exception thrown and not caught Line : 451 Character : 2 Code : 0 URI : /js/swfupload/swfupload.js
and the submit button of my form doesn't work.
Here is the faulty function
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
argumentArray = argumentArray || [];
var movieElement = this.getMovieElement();
var returnValue, returnString;
// Flash's method if calling ExternalInterface methods (code adapted from MooTools).
try {
returnString = movieElement.CallFunction('<invoke name="' + functionName + '" returntype="javascript">' + __flash__argumentsToXML(argumentArray, 0) + '</invoke>');
returnValue = eval(returnString);
} catch (ex) {
throw "Call to " + functionName + " failed";
}
// Unescape file post param values
if (returnValue != undefined && typeof returnValue.post === "object") {
returnValue = 开发者_如何学Cthis.unescapeFilePostParams(returnValue);
}
return returnValue;
};
And the uploadSuccess event :
function uploadSuccess(file, serverData) {
if (serverData != "")
{
this.uploadError(file, SWFUpload.UPLOAD_ERROR.HTTP_ERROR, serverData);
}
else
{
try {
var progress = new FileProgress(file, this.customSettings.progressTarget);
progress.setComplete();
if (this.customSettings.langue == "fr")
{
progress.setStatus("Complété.");
}
else
{
progress.setStatus("Complete.");
}
progress.toggleCancel(false);
document.getElementById("preview").innerHTML = "<div id='cadre-image'><input type='hidden' name='txtFichier' value='" + file.name + "'><img id='imgPreview' src='images/thumbnailVideo.php?src=" + file.name + "&save=true' /><p>" + file.name + "</p></div>";
document.getElementById("tdAjouter").innerHTML = "<input type='submit' value='Ajouter' />";
var divupload = document.getElementById("upload");
divupload.style.display = "none";
} catch (ex) {
this.debug(ex);
}
}
}
精彩评论