Development Need flash help

Discussion in 'Software' started by Draxin, 27 May 2008.

  1. Draxin

    Draxin Seeker of Photons

    Joined:
    29 Nov 2001
    Posts:
    965
    Likes Received:
    5
    this has been a pain in my rear.

    finally bought yet another uploader that actully does what i need it too.
    save for 2 things.
    1) It says it uploads when it doesnt IF the file you are uploading has a space in the name.
    2) I cant get it to filter allowable file-types.

    here is the action script
    a cookie to the first person that can add those two things

    Code:
    _root.onEnterFrame = function() {
    	trace("onEnterFrame called");
    }
    
    stop();
    
    //import the FileReference Object
    import flash.net.FileReference;
    
    //initial settings
    upload_butn.enabled = false;
    
    //the fileReference object
    var file_fr:FileReference = new FileReference();
    
    //object for listening to for FileReference events
    var list_obj:Object = new Object();
    
    list_obj.onSelect = function() {
    	upload_butn.enabled = true;
    	name_txt.text = file_fr.name;
    }
    
    list_obj.onComplete = function() {
    	if (_root.redirect == "false") {
    		_root.gotoAndStop("1");
    		name_txt.text = "All Done";
    		rec_mc.clear();
    		upload_butn.enabled = false;
    	} else {
    		if (_root.passFileDetails == "Y") {
    			getURL(_root.redirectUrl + "?custom=" + _root.custom + "&filename=" + file_fr.name + "&filesize=" + file_fr.size + "&filetype=" + file_fr.type + "", "_self");
    		} else {
    			getURL(_root.redirectUrl, "_self");
    		}
    	}
    }
    
    list_obj.onProgress = function (bytesTotal, bytesLoaded){
    	var percent = bytesLoaded/file_fr.size;
    	_root.loaded_txt.text = Math.round(bytesLoaded/1024) + " KB";
    	_root.size_txt.text = Math.round(file_fr.size/1024) + " KB";
    	_root.perc_txt.text = Math.round(percent * 100);
    	drawRec(percent);
    }
    
    //if a user selects cancel
    list_obj.onCancel = function() {
    	name_txt.text = "Cancel was selected";
    }
    
    //if there is an IO error
    list_obj.onIOError = function(fileRef) {
    	name_txt.text = "IO error with " + fileRef.name;
    }
    
    //security error problem
    list_obj.onSecurityError = function(fileRef, error) {
    	name_txt.text = "Security error with " + fileRef.name + ":" + error;
    }
    
    //httpError
    list_obj.onHTTPError = function(fileRef:FileReference, error:Number) {
    	name_txt.text += "HTTP error: with " + fileRef.name + ":error #" + error;
    }
    
    
    //attach the listener
    file_fr.addListener(list_obj);
    
    //the event for the browse button
    browse_butn.clickHandler = function() {
    	file_fr.browse();
    }
    
    //the event for the upload button
    upload_butn.clickHandler = function() {	
    	_root.gotoAndStop("2");
    	file_fr.upload(_root.uploadFileName + "?nocache=" + random(999) + "&custom=" + _root.custom + "");
    	rec_mc.fillColor = Math.random()*0x1000000;
    }
    
    //drawing the rectangle
    function drawRec(per) {
    	rec_mc.clear();
    	rec_mc.lineStyle(0);
    	rec_mc.beginFill(rec_mc.fillColor, 70);
    	rec_mc.lineTo((per*300), 0);
    	rec_mc.lineTo((per*300), 30);
    	rec_mc.lineTo(0, 30);
    	rec_mc.lineTo(0,0);
    	//rec_mc.lineTo(0,30);
    	//rec_mc.lineTo(0,30);
    	rec_mc.endFill();
    }
    
    please help me i dont know flash, i dont like flash but i just need this to work.
    im so frustrated with this im about ready to cry :waah:
     
  2. Draxin

    Draxin Seeker of Photons

    Joined:
    29 Nov 2001
    Posts:
    965
    Likes Received:
    5
    ok forget the cookie.
    ill pay the first person who can add those 2 features
    paypal, check...

    please
    im offering money.
    the amount is negotiable
     
  3. Glider

    Glider /dev/null

    Joined:
    2 Aug 2005
    Posts:
    4,173
    Likes Received:
    21
    Well, your script won't work on any of my systems because I block flash, so I can't help you... But why not use PHP or something for this?
     
  4. Draxin

    Draxin Seeker of Photons

    Joined:
    29 Nov 2001
    Posts:
    965
    Likes Received:
    5
    i would but i need a progress bar. welll i wouldnt say i need it but the people its for say it MUST have one.

    and they requested it be flash
     

Share This Page