SWFUpload flash文件上传使用集锦

来源:互联网 发布:antpool矿池挖矿软件 编辑:程序博客网 时间:2024/06/05 12:49

1)、重写事件:

$.fn.imgbox = function(v) {        var s = {            key: '',            url: '',            source: [],            max: 0,            type: 'default',            button: 'swfUploadImageHolder',            hdkey: '',            imgurl :'/images/upload.gif'        };        $.extend(s, v);


var swfu = new SWFUpload({            flash_url: '/swf/swfupload.swf',            flash9_url: '/swf/swfupload_fp9.swf',            upload_url: s.host + '/UploadImage.aspx?Key=' + s.key + '|' + s.type,            file_types: '*.jpg;*.png;*.gif',            file_types_description: 'Image Files',            file_upload_limit: s.max,//此处重写            file_queue_limit: 0,            custom_settings: { target: c },            debug: false,            button_placeholder_id: s.button,//此处重写            button_width: 39,            button_height: 24,            button_image_url: s.imgurl,//此处重写            button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,            button_cursor: SWFUpload.CURSOR.HAND,            file_queued_handler: imageQueued,            file_queue_error_handler: fileQueueError,            file_dialog_complete_handler: imgDialogComplete,            upload_start_handler: uploadStart,            upload_error_handler: uploadError,            upload_success_handler: imageSuccess        });        return c;    };


2、button_height:指定Flash按钮的高度,应该为button_image_url所指定的按钮背景图片高度的1/4。

所以更换按钮背景的的图标需要是button_height设置高度的4倍。比如图片高度是80(px)的,那么初始显示的高度是background-postion:0 0;那么当鼠标移到按钮上时(onmouseover):显示图片的位置为:background-postion:0 -20px;参数参考:http://www.cnblogs.com/2050/archive/2012/08/29/2662932.html

0 0