views:

44

answers:

1

Hi.

I am using the SWFUpload from http://www.anedix.com/data/file/news/realname/swfupload-php-example-v1_4.zip and want to integrate this into my wordpress plugin.

In the example file there are JS files that need to be referenced.

I have enqueued these files in my plugin and they seems to be picked up in the header.

function add_admin_js() {

switch ($_GET['page']) {
    case "videos" :
        //wp_enqueue_script('swfobject', MYPLUGIN_URLPATH.'scripts/swfobject.js');
        wp_enqueue_script('uploadify', MYPLUGIN_URLPATH.'scripts/jquery.uploadify.v2.1.0.min.js');
        wp_enqueue_script('swfupload', MYPLUGIN_URLPATH.'swfupload/swfupload.js');
        wp_enqueue_script('swfupload.queue', MYPLUGIN_URLPATH.'swfupload/js/swfupload.queue.js');
        wp_enqueue_script('fileprogress', MYPLUGIN_URLPATH.'swfupload/js/fileprogress.js');
        wp_enqueue_script('swfupload.speed', MYPLUGIN_URLPATH.'swfupload/plugins/swfupload.speed.js');
        wp_enqueue_script('handlers', MYPLUGIN_URLPATH.'swfupload/js/handlers.js');
    break;      
}

}

one little thing which I cannot work out is how to get the plugin to instantiate the function.

by default the example page uses the JS code as follows:

var swfu;
window.onload = function () {
swfu = new SWFUpload({


});
};

A: 

solved it.

After realizing SWFUpload is already used is Wordpress it made it a lot easier.

jQuery(document).ready(function() {
    var settings = {
        ...
        ...
        ...
    };
    swfu = new SWFUploader(settings);
});

And it seems to work fine now.

ApPeL
Please post your solution code, so that if someone else looking in to this same subject can use it as a guide. Glad you were able to solve your issue. :)
hsatterwhite