SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2007
    Location
    Indonesia - Bali
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    where is the function parameter filled?

    Hii.. friends i'am learning JSON Style javascript coding.. i got confused with parameter in a function. i want to implementing SWFUpload, but get stuck when customizing the Upload interface. i want to modif existing example handler.

    below is part of FeaturesDemo class codes
    Code JavaScript:
    var FeaturesDemoHandlers = {
    	swfUploadLoaded: function() {
    		FeaturesDemo.start(this);  // This refers to the SWFObject because SWFUpload calls this with .apply(this).
    	},
    	fileDialogStart : function () {
    		try {
    			FeaturesDemo.selEventsQueue.options[FeaturesDemo.selEventsQueue.options.length] = new Option("File Dialog Start", "");
    		} catch (ex) {
    			this.debug(ex);
    		}
    	},
     
    	fileQueued : function (fileObj) {
    		try {
    			var queue_string = fileObj.id + ":  0%:" + fileObj.name;
    			FeaturesDemo.selQueue.options[FeaturesDemo.selQueue.options.length] = new Option(queue_string, fileObj.id);
    			FeaturesDemo.selEventsQueue.options[FeaturesDemo.selEventsQueue.options.length] = new Option("File Queued: " + fileObj.id, "");
    		} catch (ex) { this.debug(ex); }
    	}
    };

    and just for example, what exactly i mean, method fileQueued is called file_queued_handler : FeaturesDemoHandlers.fileQueued
    fileQueued method have a parameter named fileObj. i don't know when parameter is filled? i mean like file_queued_handler : FeaturesDemoHandlers.fileQueued(the_value_of_parameter)
    but i didn't have to see fileQueued() method is called with its param. and exactly it works?

    Code JavaScript:
    var suo;
    		window.onload = function() {
    			// Check to see if SWFUpload is available
    			if (typeof(SWFUpload) === "undefined") return;
     
    			// Instantiate a SWFUpload Instance
    			suo = new SWFUpload({
    				// Backend Settings
    				upload_url: "../featuresdemo/upload.php?get_name=get_value",	// I can pass query strings here if I want
    				post_params: { "post_name1": "post_value1", "post_name2": "post_value2" }, 	// Here are some POST values to send. These can be changed dynamically
    				file_post_name: "Filedata",	// This is the "name" of the file item that the server-side script will receive. Setting this doesn't work in the Linux Flash Player
     
    				// File Upload Settings
    				file_size_limit : "102400",	// 100MB
    				file_types : "*.*",
    				file_types_description : "All Files",
    				file_upload_limit : "10",
     
    				// Event Handler Settings
     
    				file_queued_handler : FeaturesDemoHandlers.fileQueued,

    thank you i'am sorry for my bad english

  2. #2
    SitePoint Wizard chris_fuel's Avatar
    Join Date
    May 2006
    Location
    Ventura, CA
    Posts
    2,750
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The parameter is probably handled somewhere else. IE, somewhere in the code you'll have something like:

    Code:
    this.file_queued_handler(fileObject);
    So you'd have to check the SWFUpload class to find it.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2007
    Location
    Indonesia - Bali
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I never coding a JS with JSON style before. so i don't know where is the value param come from..
    after reading updated manual of SWFUpload,, i got it!
    thanks for the attention


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •