2 Copyright (c) 2009, Yahoo! Inc. All rights reserved.
3 Code licensed under the BSD License:
4 http://developer.yahoo.net/yui/license.txt
7 /*extern ActiveXObject, __flash_unloadHandler, __flash_savedUnloadHandler */
9 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
11 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
12 * http://www.opensource.org/licenses/mit-license.php
16 YAHOO.namespace("deconcept");
18 YAHOO.deconcept = YAHOO.deconcept || {};
20 if(typeof YAHOO.deconcept.util == "undefined" || !YAHOO.deconcept.util)
22 YAHOO.deconcept.util = {};
25 if(typeof YAHOO.deconcept.SWFObjectUtil == "undefined" || !YAHOO.deconcept.SWFObjectUtil)
27 YAHOO.deconcept.SWFObjectUtil = {};
30 YAHOO.deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey)
32 if(!document.getElementById) { return; }
33 this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
34 this.skipDetect = YAHOO.deconcept.util.getRequestParameter(this.DETECT_KEY);
38 if(swf) { this.setAttribute('swf', swf); }
39 if(id) { this.setAttribute('id', id); }
40 if(w) { this.setAttribute('width', w); }
41 if(h) { this.setAttribute('height', h); }
42 if(ver) { this.setAttribute('version', new YAHOO.deconcept.PlayerVersion(ver.toString().split("."))); }
43 this.installedVer = YAHOO.deconcept.SWFObjectUtil.getPlayerVersion();
44 if (!window.opera && document.all && this.installedVer.major > 7)
46 // only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
47 YAHOO.deconcept.SWFObject.doPrepUnload = true;
51 this.addParam('bgcolor', c);
53 var q = quality ? quality : 'high';
54 this.addParam('quality', q);
55 this.setAttribute('useExpressInstall', false);
56 this.setAttribute('doExpressInstall', false);
57 var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
58 this.setAttribute('xiRedirectUrl', xir);
59 this.setAttribute('redirectUrl', '');
62 this.setAttribute('redirectUrl', redirectUrl);
66 YAHOO.deconcept.SWFObject.prototype =
68 useExpressInstall: function(path)
70 this.xiSWFPath = !path ? "expressinstall.swf" : path;
71 this.setAttribute('useExpressInstall', true);
73 setAttribute: function(name, value){
74 this.attributes[name] = value;
76 getAttribute: function(name){
77 return this.attributes[name];
79 addParam: function(name, value){
80 this.params[name] = value;
82 getParams: function(){
85 addVariable: function(name, value){
86 this.variables[name] = value;
88 getVariable: function(name){
89 return this.variables[name];
91 getVariables: function(){
92 return this.variables;
94 getVariablePairs: function(){
95 var variablePairs = [];
97 var variables = this.getVariables();
100 if(variables.hasOwnProperty(key))
102 variablePairs[variablePairs.length] = key +"="+ variables[key];
105 return variablePairs;
107 getSWFHTML: function() {
112 if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
113 if (this.getAttribute("doExpressInstall")) {
114 this.addVariable("MMplayerType", "PlugIn");
115 this.setAttribute('swf', this.xiSWFPath);
117 swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'"';
118 swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
119 params = this.getParams();
122 if(params.hasOwnProperty(key))
124 swfNode += [key] +'="'+ params[key] +'" ';
127 pairs = this.getVariablePairs().join("&");
128 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
131 if (this.getAttribute("doExpressInstall")) {
132 this.addVariable("MMplayerType", "ActiveX");
133 this.setAttribute('swf', this.xiSWFPath);
135 swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ this.getAttribute('style') +'">';
136 swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
137 params = this.getParams();
140 if(params.hasOwnProperty(key))
142 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
145 pairs = this.getVariablePairs().join("&");
146 if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
147 swfNode += "</object>";
151 write: function(elementId)
153 if(this.getAttribute('useExpressInstall')) {
154 // check to see if we need to do an express install
155 var expressInstallReqVer = new YAHOO.deconcept.PlayerVersion([6,0,65]);
156 if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
157 this.setAttribute('doExpressInstall', true);
158 this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
159 document.title = document.title.slice(0, 47) + " - Flash Player Installation";
160 this.addVariable("MMdoctitle", document.title);
163 if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version')))
165 var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
166 n.innerHTML = this.getSWFHTML();
171 if(this.getAttribute('redirectUrl') !== "")
173 document.location.replace(this.getAttribute('redirectUrl'));
180 /* ---- detection functions ---- */
181 YAHOO.deconcept.SWFObjectUtil.getPlayerVersion = function()
184 var PlayerVersion = new YAHOO.deconcept.PlayerVersion([0,0,0]);
185 if(navigator.plugins && navigator.mimeTypes.length)
187 var x = navigator.plugins["Shockwave Flash"];
188 if(x && x.description)
190 PlayerVersion = new YAHOO.deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
193 else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0)
201 axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
202 // document.write("player v: "+ counter);
203 PlayerVersion = new YAHOO.deconcept.PlayerVersion([counter,0,0]);
212 { // Win IE (non mobile)
213 // do minor version lookup in IE, but avoid fp6 crashing issues
214 // see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
217 axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
223 axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
224 PlayerVersion = new YAHOO.deconcept.PlayerVersion([6,0,21]);
225 axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
229 if(PlayerVersion.major == 6)
231 return PlayerVersion;
236 axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
243 PlayerVersion = new YAHOO.deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
246 return PlayerVersion;
249 YAHOO.deconcept.PlayerVersion = function(arrVersion)
251 this.major = arrVersion[0] !== null ? parseInt(arrVersion[0], 0) : 0;
252 this.minor = arrVersion[1] !== null ? parseInt(arrVersion[1], 0) : 0;
253 this.rev = arrVersion[2] !== null ? parseInt(arrVersion[2], 0) : 0;
256 YAHOO.deconcept.PlayerVersion.prototype.versionIsValid = function(fv)
258 if(this.major < fv.major)
262 if(this.major > fv.major)
266 if(this.minor < fv.minor)
270 if(this.minor > fv.minor)
274 if(this.rev < fv.rev)
281 /* ---- get value of query string param ---- */
282 YAHOO.deconcept.util =
284 getRequestParameter: function(param)
286 var q = document.location.search || document.location.hash;
287 if(param === null) { return q; }
290 var pairs = q.substring(1).split("&");
291 for(var i=0; i < pairs.length; i++)
293 if (pairs[i].substring(0, pairs[i].indexOf("=")) == param)
295 return pairs[i].substring((pairs[i].indexOf("=") + 1));
303 /* fix for video streaming bug */
304 YAHOO.deconcept.SWFObjectUtil.cleanupSWFs = function()
306 var objects = document.getElementsByTagName("OBJECT");
307 for(var i = objects.length - 1; i >= 0; i--)
309 objects[i].style.display = 'none';
310 for(var x in objects[i])
312 if(typeof objects[i][x] == 'function')
314 objects[i][x] = function(){};
320 // fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
321 if(YAHOO.deconcept.SWFObject.doPrepUnload)
323 if(!YAHOO.deconcept.unloadSet)
325 YAHOO.deconcept.SWFObjectUtil.prepUnload = function()
327 __flash_unloadHandler = function(){};
328 __flash_savedUnloadHandler = function(){};
329 window.attachEvent("onunload", YAHOO.deconcept.SWFObjectUtil.cleanupSWFs);
331 window.attachEvent("onbeforeunload", YAHOO.deconcept.SWFObjectUtil.prepUnload);
332 YAHOO.deconcept.unloadSet = true;
336 /* add document.getElementById if needed (mobile IE < 5) */
337 if(!document.getElementById && document.all)
339 document.getElementById = function(id) { return document.all[id]; };
342 * Wraps Flash embedding functionality and allows communication with SWF through
345 * @namespace YAHOO.widget
346 * @class FlashAdapter
347 * @uses YAHOO.util.AttributeProvider
349 YAHOO.widget.FlashAdapter = function(swfURL, containerID, attributes, buttonSkin)
352 this._queue = this._queue || [];
353 this._events = this._events || {};
354 this._configs = this._configs || {};
355 attributes = attributes || {};
357 //the Flash Player external interface code from Adobe doesn't play nicely
358 //with the default value, yui-gen, in IE
359 this._id = attributes.id = attributes.id || YAHOO.util.Dom.generateId(null, "yuigen");
360 attributes.version = attributes.version || "9.0.45";
361 attributes.backgroundColor = attributes.backgroundColor || "#ffffff";
363 //we can't use the initial attributes right away
364 //so save them for once the SWF finishes loading
365 this._attributes = attributes;
367 this._swfURL = swfURL;
368 this._containerID = containerID;
370 //embed the SWF file in the page
371 this._embedSWF(this._swfURL, this._containerID, attributes.id, attributes.version,
372 attributes.backgroundColor, attributes.expressInstall, attributes.wmode, buttonSkin);
375 * Fires when the SWF is initialized and communication is possible.
376 * @event contentReady
378 //Fix for iframe cross-domain issue with FF2x
381 this.createEvent("contentReady");
386 YAHOO.widget.FlashAdapter.owners = YAHOO.widget.FlashAdapter.owners || {};
388 YAHOO.extend(YAHOO.widget.FlashAdapter, YAHOO.util.AttributeProvider,
391 * The URL of the SWF file.
399 * The ID of the containing DIV.
400 * @property _containerID
407 * A reference to the embedded SWF file.
414 * The id of this instance.
422 * Indicates whether the SWF has been initialized and is ready
423 * to communicate with JavaScript
424 * @property _initialized
431 * The initializing attributes are stored here until the SWF is ready.
432 * @property _attributes
436 _attributes: null, //the intializing attributes
439 * Public accessor to the unique name of the FlashAdapter instance.
442 * @return {String} Unique name of the FlashAdapter instance.
446 return "FlashAdapter " + this._id;
450 * Nulls out the entire FlashAdapter instance and related objects and removes attached
451 * event listeners and clears out DOM elements inside the container. After calling
452 * this method, the instance reference should be expliclitly nulled by implementer,
453 * as in myChart = null. Use with caution!
459 //kill the Flash Player instance
462 var container = YAHOO.util.Dom.get(this._containerID);
463 container.removeChild(this._swf);
466 var instanceName = this._id;
468 //null out properties
469 for(var prop in this)
471 if(YAHOO.lang.hasOwnProperty(this, prop))
480 * Embeds the SWF in the page and associates it with this instance.
485 _embedSWF: function(swfURL, containerID, swfID, version, backgroundColor, expressInstall, wmode, buttonSkin)
487 //standard SWFObject embed
488 var swfObj = new YAHOO.deconcept.SWFObject(swfURL, swfID, "100%", "100%", version, backgroundColor);
492 swfObj.useExpressInstall(expressInstall);
495 //make sure we can communicate with ExternalInterface
496 swfObj.addParam("allowScriptAccess", "always");
500 swfObj.addParam("wmode", wmode);
503 swfObj.addParam("menu", "false");
505 //again, a useful ExternalInterface trick
506 swfObj.addVariable("allowedDomain", document.location.hostname);
508 //tell the SWF which HTML element it is in
509 swfObj.addVariable("elementID", swfID);
511 // set the name of the function to call when the swf has an event
512 swfObj.addVariable("eventHandler", "YAHOO.widget.FlashAdapter.eventHandler");
514 swfObj.addVariable("buttonSkin", buttonSkin);
516 var container = YAHOO.util.Dom.get(containerID);
517 var result = swfObj.write(container);
520 this._swf = YAHOO.util.Dom.get(swfID);
521 YAHOO.widget.FlashAdapter.owners[swfID] = this;
529 * Handles or re-dispatches events received from the SWF.
531 * @method _eventHandler
534 _eventHandler: function(event)
536 var type = event.type;
547 //be sure to return after your case or the event will automatically fire!
548 this.fireEvent(type, event);
552 * Called when the SWF has been initialized.
554 * @method _loadHandler
557 _loadHandler: function()
559 this._initialized = false;
560 this._initAttributes(this._attributes);
561 this.setAttributes(this._attributes, true);
563 this._initialized = true;
564 this.fireEvent("contentReady");
567 set: function(name, value)
569 //save all the attributes in case the swf reloads
570 //so that we can pass them in again
571 this._attributes[name] = value;
572 YAHOO.widget.FlashAdapter.superclass.set.call(this, name, value);
576 * Initializes the attributes.
578 * @method _initAttributes
581 _initAttributes: function(attributes)
583 //should be overridden if other attributes need to be set up
587 * @description Sets the window mode of the Flash Player control. May be
588 * "window", "opaque", or "transparent". Only available in the constructor
589 * because it may not be set after Flash Player has been embedded in the page.
594 * @attribute expressInstall
595 * @description URL pointing to a SWF file that handles Flash Player's express
596 * install feature. Only available in the constructor because it may not be
597 * set after Flash Player has been embedded in the page.
603 * @description Minimum required version for the SWF file. Only available in the constructor because it may not be
604 * set after Flash Player has been embedded in the page.
609 * @attribute backgroundColor
610 * @description The background color of the SWF. Only available in the constructor because it may not be
611 * set after Flash Player has been embedded in the page.
617 * @description The alternative text to provide for screen readers and other assistive technology.
620 this.getAttributeConfig("altText",
622 method: this._getAltText
624 this.setAttributeConfig("altText",
626 method: this._setAltText
631 * @description Absolute or relative URL to the SWF displayed by the FlashAdapter. Only available in the constructor because it may not be
632 * set after Flash Player has been embedded in the page.
635 this.getAttributeConfig("swfURL",
637 method: this._getSWFURL
642 * Getter for swfURL attribute.
647 _getSWFURL: function()
653 * Getter for altText attribute.
655 * @method _getAltText
658 _getAltText: function()
660 return this._swf.getAltText();
664 * Setter for altText attribute.
666 * @method _setAltText
669 _setAltText: function(value)
671 return this._swf.setAltText(value);
677 * Receives event messages from SWF and passes them to the correct instance
680 * @method YAHOO.widget.FlashAdapter.eventHandler
684 YAHOO.widget.FlashAdapter.eventHandler = function(elementID, event)
687 if(!YAHOO.widget.FlashAdapter.owners[elementID])
689 //fix for ie: if owner doesn't exist yet, try again in a moment
690 setTimeout(function() { YAHOO.widget.FlashAdapter.eventHandler( elementID, event ); }, 0);
694 YAHOO.widget.FlashAdapter.owners[elementID]._eventHandler(event);
699 * The number of proxy functions that have been created.
703 YAHOO.widget.FlashAdapter.proxyFunctionCount = 0;
706 * Creates a globally accessible function that wraps a function reference.
707 * Returns the proxy function's name as a string for use by the SWF through
710 * @method YAHOO.widget.FlashAdapter.createProxyFunction
714 YAHOO.widget.FlashAdapter.createProxyFunction = function(func)
716 var index = YAHOO.widget.FlashAdapter.proxyFunctionCount;
717 YAHOO.widget.FlashAdapter["proxyFunction" + index] = function()
719 return func.apply(null, arguments);
721 YAHOO.widget.FlashAdapter.proxyFunctionCount++;
722 return "YAHOO.widget.FlashAdapter.proxyFunction" + index.toString();
726 * Removes a function created with createProxyFunction()
728 * @method YAHOO.widget.FlashAdapter.removeProxyFunction
732 YAHOO.widget.FlashAdapter.removeProxyFunction = function(funcName)
735 if(!funcName || funcName.indexOf("YAHOO.widget.FlashAdapter.proxyFunction") < 0)
740 funcName = funcName.substr(26);
741 YAHOO.widget.FlashAdapter[funcName] = null;
744 * The YUI Uploader Control
746 * @description <p>YUI Uploader provides file upload functionality that goes beyond the basic browser-based methods.
747 * Specifically, the YUI Uploader allows for:
749 * <li> Multiple file selection in a single "Open File" dialog.</li>
750 * <li> File extension filters to facilitate the user's selection.</li>
751 * <li> Progress tracking for file uploads.</li>
752 * <li> A range of file metadata: filename, size, date created, date modified, and author.</li>
753 * <li> A set of events dispatched on various aspects of the file upload process: file selection, upload progress, upload completion, etc.</li>
754 * <li> Inclusion of additional data in the file upload POST request.</li>
755 * <li> Faster file upload on broadband connections due to the modified SEND buffer size.</li>
756 * <li> Same-page server response upon completion of the file upload.</li>
760 * @namespace YAHOO.widget
761 * @requires yahoo, dom, element, event
764 * Uploader class for the YUI Uploader component.
766 * @namespace YAHOO.widget
768 * @uses YAHOO.widget.FlashAdapter
770 * @param containerId {HTMLElement} Container element for the Flash Player instance.
771 * @param buttonSkin {String} [optional]. If defined, the uploader is
772 * rendered as a button. This parameter must provide the URL of a button
773 * skin sprite image. Acceptable types are: jpg, gif, png and swf. The
774 * sprite is divided evenly into four sections along its height (e.g., if
775 * the sprite is 200 px tall, it's divided into four sections 50px each).
776 * Each section is used as a skin for a specific state of the button: top
777 * section is "up", second section is "over", third section is "down", and
778 * fourth section is "disabled".
779 * If the parameter is not supplied, the uploader is rendered transparent,
780 * and it's the developer's responsibility to create a visible UI below it.
781 * @param forceTransparent {Boolean} This parameter, if true, forces the Flash
782 * UI to be rendered with wmode set to "transparent". This behavior is useful
783 * in conjunction with non-rectangular button skins with PNG transparency.
784 * The parameter is false by default, and ignored if no buttonSkin is defined.
786 YAHOO.widget.Uploader = function(containerId, buttonSkin, forceTransparent)
788 var newWMode = "window";
790 if (!(buttonSkin) || (buttonSkin && forceTransparent)) {
791 newWMode = "transparent";
795 YAHOO.widget.Uploader.superclass.constructor.call(this, YAHOO.widget.Uploader.SWFURL, containerId, {wmode:newWMode}, buttonSkin);
798 * Fires when the mouse is pressed over the Uploader.
799 * Only fires when the Uploader UI is enabled and
800 * the render type is 'transparent'.
803 * @param event.type {String} The event type
805 this.createEvent("mouseDown");
808 * Fires when the mouse is released over the Uploader.
809 * Only fires when the Uploader UI is enabled and
810 * the render type is 'transparent'.
813 * @param event.type {String} The event type
815 this.createEvent("mouseUp");
818 * Fires when the mouse rolls over the Uploader.
821 * @param event.type {String} The event type
823 this.createEvent("rollOver");
826 * Fires when the mouse rolls out of the Uploader.
829 * @param event.type {String} The event type
831 this.createEvent("rollOut");
834 * Fires when the uploader is clicked.
837 * @param event.type {String} The event type
839 this.createEvent("click");
842 * Fires when the user has finished selecting files in the "Open File" dialog.
845 * @param event.type {String} The event type
846 * @param event.fileList {Object} A dictionary of objects with file information
847 * @param event.fileList[].size {Number} File size in bytes for a specific file in fileList
848 * @param event.fileList[].cDate {Date} Creation date for a specific file in fileList
849 * @param event.fileList[].mDate {Date} Modification date for a specific file in fileList
850 * @param event.fileList[].name {String} File name for a specific file in fileList
851 * @param event.fileList[].id {String} Unique file id of a specific file in fileList
853 this.createEvent("fileSelect");
856 * Fires when an upload of a specific file has started.
859 * @param event.type {String} The event type
860 * @param event.id {String} The id of the file that's started to upload
862 this.createEvent("uploadStart");
865 * Fires when new information about the upload progress for a specific file is available.
867 * @event uploadProgress
868 * @param event.type {String} The event type
869 * @param event.id {String} The id of the file with which the upload progress data is associated
870 * @param bytesLoaded {Number} The number of bytes of the file uploaded so far
871 * @param bytesTotal {Number} The total size of the file
873 this.createEvent("uploadProgress");
876 * Fires when an upload for a specific file is cancelled.
878 * @event uploadCancel
879 * @param event.type {String} The event type
880 * @param event.id {String} The id of the file with which the upload has been cancelled.
882 this.createEvent("uploadCancel");
885 * Fires when an upload for a specific file is complete.
887 * @event uploadComplete
888 * @param event.type {String} The event type
889 * @param event.id {String} The id of the file for which the upload has been completed.
891 this.createEvent("uploadComplete");
894 * Fires when the server sends data in response to a completed upload.
896 * @event uploadCompleteData
897 * @param event.type {String} The event type
898 * @param event.id {String} The id of the file for which the upload has been completed.
899 * @param event.data {String} The raw data returned by the server in response to the upload.
901 this.createEvent("uploadCompleteData");
904 * Fires when an upload error occurs.
907 * @param event.type {String} The event type
908 * @param event.id {String} The id of the file that was being uploaded when the error has occurred.
909 * @param event.status {String} The status message associated with the error.
911 this.createEvent("uploadError");
915 * Location of the Uploader SWF
917 * @property Chart.SWFURL
921 * @default "assets/uploader.swf"
923 YAHOO.widget.Uploader.SWFURL = "assets/uploader.swf";
925 YAHOO.extend(YAHOO.widget.Uploader, YAHOO.widget.FlashAdapter,
928 * Starts the upload of the file specified by fileID to the location specified by uploadScriptPath.
930 * @param fileID {String} The id of the file to start uploading.
931 * @param uploadScriptPath {String} The URL of the upload location.
932 * @param method {String} Either "GET" or "POST", specifying how the variables accompanying the file upload POST request should be submitted. "GET" by default.
933 * @param vars {Object} The object containing variables to be sent in the same request as the file upload.
934 * @param fieldName {String} The name of the variable in the POST request containing the file data. "Filedata" by default.
937 upload: function(fileID, uploadScriptPath, method, vars, fieldName)
939 this._swf.upload(fileID, uploadScriptPath, method, vars, fieldName);
943 * Starts the upload of the files specified by fileIDs, or adds them to a currently running queue. The upload queue is automatically managed.
945 * @param fileIDs {Array} The ids of the files to start uploading.
946 * @param uploadScriptPath {String} The URL of the upload location.
947 * @param method {String} Either "GET" or "POST", specifying how the variables accompanying the file upload POST request should be submitted. "GET" by default.
948 * @param vars {Object} The object containing variables to be sent in the same request as the file upload.
949 * @param fieldName {String} The name of the variable in the POST request containing the file data. "Filedata" by default.
952 uploadThese: function(fileIDs, uploadScriptPath, method, vars, fieldName)
954 this._swf.uploadThese(fileIDs, uploadScriptPath, method, vars, fieldName);
958 * Starts uploading all files in the queue. If this function is called, the upload queue is automatically managed.
960 * @param uploadScriptPath {String} The URL of the upload location.
961 * @param method {String} Either "GET" or "POST", specifying how the variables accompanying the file upload POST request should be submitted. "GET" by default.
962 * @param vars {Object} The object containing variables to be sent in the same request as the file upload.
963 * @param fieldName {String} The name of the variable in the POST request containing the file data. "Filedata" by default.
966 uploadAll: function(uploadScriptPath, method, vars, fieldName)
968 this._swf.uploadAll(uploadScriptPath, method, vars, fieldName);
972 * Cancels the upload of a specified file. If no file id is specified, all ongoing uploads are cancelled.
974 * @param fileID {String} The ID of the file whose upload should be cancelled.
976 cancel: function(fileID)
978 this._swf.cancel(fileID);
982 * Clears the list of files queued for upload.
985 clearFileList: function()
987 this._swf.clearFileList();
991 * Removes the specified file from the upload queue.
993 * @param fileID {String} The id of the file to remove from the upload queue.
995 removeFile: function (fileID)
997 this._swf.removeFile(fileID);
1001 * Turns the logging functionality on.
1002 * Uses Flash internal trace logging, as well as YUI Logger, if available.
1004 * @param allowLogging {Boolean} If true, logs are output; otherwise, no logs are produced.
1006 setAllowLogging: function (allowLogging)
1008 this._swf.setAllowLogging(allowLogging);
1012 * Sets the number of simultaneous uploads when using uploadAll()
1013 * The minimum value is 1, and maximum value is 5. The default value is 2.
1015 * @param simUploadLimit {int} Number of simultaneous uploads, between 1 and 5.
1017 setSimUploadLimit : function (simUploadLimit)
1019 this._swf.setSimUploadLimit(simUploadLimit);
1023 * Sets the flag allowing users to select multiple files for the upload.
1025 * @param allowMultipleFiles {Boolean} If true, multiple files can be selected. False by default.
1027 setAllowMultipleFiles : function (allowMultipleFiles)
1029 this._swf.setAllowMultipleFiles(allowMultipleFiles);
1033 * Sets the file filters for the "Browse" dialog.
1035 * @param newFilterArray An array of sets of key-value pairs of the form
1036 * {extensions: extensionString, description: descriptionString, [optional]macType: macTypeString}
1037 * The extensions string is a semicolon-delimited list of elements of the form "*.xxx",
1038 * e.g. "*.jpg;*.gif;*.png".
1040 setFileFilters : function (fileFilters)
1042 this._swf.setFileFilters(fileFilters);
1046 * Enables the mouse events on the Uploader.
1047 * If the uploader is being rendered as a button,
1048 * then the button's skin is set to "up"
1049 * (first section of the button skin sprite).
1052 enable : function ()
1058 * Disables the mouse events on the Uploader.
1059 * If the uploader is being rendered as a button,
1060 * then the button's skin is set to "disabled"
1061 * (fourth section of the button skin sprite).
1064 disable : function ()
1066 this._swf.disable();
1069 YAHOO.register("uploader", YAHOO.widget.Uploader, {version: "2.8.0r4", build: "2449"});