aash
aash

Reputation: 1323

swfupload option button_cursor not working

I am using swfupload plugin(http://demo.swfupload.org/Documentation/) to upload multiple files. I have the following swfupload settings object defined. Everything is working fine except the cursor doesn't change to 'hand' form. Here is the code:

var initialize_swfupload_for_image = function () {

if ($('#image-attach').length == 0){
  return;
}
var url = $('#image-attach').data('url');
var params = $('#image-attach').data('params');
var buttonStyle = '.image-link {color: #FFF' +
                ';text-align: center'+
                ';} ' +
                '.image-link:hover {color: #0FF' +
                ';} ';
var settings = {
  upload_url:url,
  flash_url: "<%= asset_path('swfupload/swfupload.swf') %>",
  flash9_url: "<%= asset_path('swfupload/swfupload_fp9.swf') %>",
  http_success:[ 200, 201, 204 ],
  file_post_name:"file",
  file_types: "*.jpg; *.gif; *.png; *.jpeg",
  file_upload_limit:1,
  file_queue_limit:0,
  file_size_limit:"10 MB",
  prevent_swf_caching:false,
  custom_settings:{
    progressTarget:"divImageProgressContainer",
    cancelButtonId:"btnImageCancel"
  },
  button_placeholder_id:"image-attach",
  button_text: "<span class='image-link'>Edit Photo</span>",
  button_text_style: buttonStyle,

  button_width: 90,
  button_height: 20,
  button_cursor:SWFUpload.CURSOR.HAND,
  button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,
  button_action:SWFUpload.BUTTON_ACTION.SELECT_FILE,

  file_queued_handler:fileQueued,
  file_queue_error_handler:fileQueueError,
  file_dialog_complete_handler:fileDialogComplete,

  upload_start_handler:uploadStartImage,
  upload_error_handler:uploadError,
  upload_progress_handler:uploadProgressImage,
  upload_success_handler:uploadSuccessImage,
  upload_complete_handler:uploadCompleteImage,
  queue_complete_handler:uploadCompleteImage,

  post_params:params
};
if (FlashDetect.versionAtLeast(9)) {
  swf_image = new SWFUpload(settings);
} else {
  //intentionally left blank
  //TODO: javascript fallback when swfupload doesn't work
}

Any insights on why the cursor isn't changing on hovering over the object will be really helpful.

Upvotes: 0

Views: 1064

Answers (1)

Max Leske
Max Leske

Reputation: 5125

I have experienced the same problem. In my case the culprit was a 'px' that I had added accidentally to the button_width and button_height properties: button_width: "20px".

Your problem is obviously not the same one but it might be related in that you might have passed an invalid value to SWFUpload.

I copied your code and after cleaning it from the custom stuff I had no trouble getting the hand to show (didn't even change anything). Here's the code, tested with swfupload.swf 2.2.0.1 and swfupload.js 2.2.0 2009-03-25 (note that swfupload.swf and swfupload.js are in the same folder as the html file):

<html>
<head>
    <meta http-equiv="Content-type" content="text/html; charset=utf-8">
    <title>index</title>
    <script type="text/javascript" src="swfupload.js"></script>
    <script type="text/javascript" charset="utf-8">
    var init = function () {

    var settings = {
      upload_url:'url',
      flash_url: "swfupload.swf",
      http_success:[ 200, 201, 204 ],
      file_post_name:"file",
      file_types: "*.jpg; *.gif; *.png; *.jpeg",
      file_upload_limit:1,
      file_queue_limit:0,
      file_size_limit:"10 MB",
      prevent_swf_caching:false,
      custom_settings:{
        progressTarget:"divImageProgressContainer",
        cancelButtonId:"btnImageCancel"
      },
      button_placeholder_id:"image-attach",
      button_text: "<span class='image-link'>Edit Photo</span>",

      button_width: 90,
      button_height: 20,
      button_cursor:SWFUpload.CURSOR.HAND,
      button_window_mode:SWFUpload.WINDOW_MODE.TRANSPARENT,
      button_action:SWFUpload.BUTTON_ACTION.SELECT_FILE,

    };
      swf_image = new SWFUpload(settings);
  }
    </script>

</head>
<body id="index" onload="init()">
    <div style="width:100px;height:100px;background-color:blue">
    <div id="image-attach"></div>
    </div>
</body>
</html>

My guess remains that maybe SWFUpload doesn't like one of the parameters (e.g. the <%asset stuff). Hope this helps anyway.

Upvotes: 1

Related Questions