//flash裡傳送值
'<param name="flashvars" value="' + this.getFlashVars() + '" />'
//flash裡擷取值
this.uploadURL=root.loaderinfo.parameters.uploadURL
SWFUpload.prototype.getFlashVars = function () {
// Build a string from the post param object
var paramString = this.buildParamString();
var httpSuccessString = this.settings.http_success.join(",");
// Build the parameter string
return ["movieName=", encodeURIComponent(this.movieName),
"&amp;uploadURL=", encodeURIComponent(this.settings.upload_url),
"&amp;useQueryString=", encodeURIComponent
(this.settings.use_query_string),
"&amp;requeueOnError=", encodeURIComponent
(this.settings.requeue_on_error),
"&amp;httpSuccess=", encodeURIComponent(httpSuccessString),
"&amp;assumeSuccessTimeout=", encodeURIComponent
(this.settings.assume_success_timeout),
"&amp;params=", encodeURIComponent(paramString),
"&amp;filePostName=", encodeURIComponent
(this.settings.file_post_name),
"&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
"&amp;fileTypesDescription=", encodeURIComponent
(this.settings.file_types_description),
"&amp;fileSizeLimit=", encodeURIComponent
(this.settings.file_size_limit),
"&amp;fileUploadLimit=", encodeURIComponent
(this.settings.file_upload_limit),
"&amp;fileQueueLimit=", encodeURIComponent
(this.settings.file_queue_limit),
"&amp;debugEnabled=", encodeURIComponent
(this.settings.debug_enabled),
"&amp;buttonImageURL=", encodeURIComponent
(this.settings.button_image_url),
"&amp;buttonWidth=", encodeURIComponent(this.settings.button_width),
"&amp;buttonHeight=", encodeURIComponent
(this.settings.button_height),
"&amp;buttonText=", encodeURIComponent(this.settings.button_text),
"&amp;buttonTextTopPadding=", encodeURIComponent
(this.settings.button_text_top_padding),
"&amp;buttonTextLeftPadding=", encodeURIComponent
(this.settings.button_text_left_padding),
"&amp;buttonTextStyle=", encodeURIComponent
(this.settings.button_text_style),
"&amp;buttonAction=", encodeURIComponent
(this.settings.button_action),
"&amp;buttonDisabled=", encodeURIComponent
(this.settings.button_disabled),
"&amp;buttonCursor=", encodeURIComponent
(this.settings.button_cursor)
].join("");
};
//js調用flash中的方法
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 = this.unescapeFilePostParams(returnValue);
return returnValue;
//調用
SWFUpload.prototype.getStats = function () {
return this.callFlash("GetStats");
SWFUpload.prototype.getFile = function (fileID) {
if (typeof(fileID) === "number") {
return this.callFlash("GetFileByIndex", [fileID]);
} else {
return this.callFlash("GetFile", [fileID]);
SWFUpload.prototype.addFileParam = function (fileID, name, value) {
return this.callFlash("AddFileParam", [fileID, name, value]);
SWFUpload.prototype.getMovieElement = function () {
if (this.movieElement == undefined) {//this.movieName就是flash object的id
this.movieElement = document.getElementById(this.movieName);
if (this.movieElement === null) {
throw "Could not find Flash element";
return this.movieElement;