Gogetta 263 Posted April 22, 2010 Report Share Posted April 22, 2010 I'm trying to trigger a flash button on buzzfeed.com to upload an image. I have been at it now for a few hrs and really don't know what to do here, So I'm hoping someone can help me by looking at the code below. Thanks! <script type="text/javascript"> // hide spinner if (parent.document.getElementById('user-loading')) parent.document.getElementById('user-loading').style.display = 'none'; // register even for image cancel var cElement = document.getElementById("image-cancel"); YAHOO.util.Event.addListener(cElement, "click", function(e) { YAHOO.util.Event.stopEvent(e); var iframe = parent.document.getElementById('user-image-edit-iframe'); iframe.src="/static/images/public/spinners/big_on_eee.gif"; parent.document.getElementById('user-image-edit').style.display = 'none'; }); var hasReqestedVersion = DetectFlashVer(9, 0, 45); //alert(hasReqestedVersion); if(hasReqestedVersion) { YAHOO.widget.Uploader.SWFURL = "/static/js/yui2.6/uploader/assets/uploader.swf"; var uploader = new YAHOO.widget.Uploader( "toBeReplaced", 'http://s-ak.buzzfed.com/static/images/uploader/select.png' ); user_image.init(uploader); } else { document.getElementById("toBeReplaced").style.display = 'block'; } </script> Quote Link to post Share on other sites
sputnik13 12 Posted April 22, 2010 Report Share Posted April 22, 2010 I had a really rough go with this issue a while back - sadly i just settled for a script pause and user action to click the flash button. My added challenge was that i had to load a subwindow. Im eyein this thread to see how this get solved :-) Quote Link to post Share on other sites
some_guy 11 Posted April 22, 2010 Report Share Posted April 22, 2010 My javascript skills are pretty rubbish, so can't help that much, but if you can get the ID of the control you want to fire, you can use something like var fireThis = document.getElementById('**ELEMENT HERE**'); if( document.createEventObject ) { fireThis.fireEvent('click'); } replace **ELEMENT HERE** for the element ID you wantyou can replace 'click' for any JS event, so onchange, mouseup, mousedown etc etc 1 Quote Link to post Share on other sites
some_guy 11 Posted April 22, 2010 Report Share Posted April 22, 2010 Have been trying to test it out in buzzfeed, but cannot get the flash thing to work at all. Just get a black box with a save and cancel button. From what I can tell, the code you have posted above is not relevant but tbh I don't really know. Will have another look next time reboot machine to see if that helps me run the flash. Quote Link to post Share on other sites
Gogetta 263 Posted April 23, 2010 Author Report Share Posted April 23, 2010 Have been trying to test it out in buzzfeed, but cannot get the flash thing to work at all. Just get a black box with a save and cancel button. From what I can tell, the code you have posted above is not relevant but tbh I don't really know. Will have another look next time reboot machine to see if that helps me run the flash. I sure do appreciate the effort, and also the code you shared. Yeah, I'm not sure that the script i posted helps at all. Thanks again. Quote Link to post Share on other sites
sskl 3 Posted April 23, 2010 Report Share Posted April 23, 2010 var hasReqestedVersion = true; ? But even it is that's the case, how do you excecute upload.swf without flash? My getround would be writing a static html for uploading Quote Link to post Share on other sites
sputnik13 12 Posted April 23, 2010 Report Share Posted April 23, 2010 var hasReqestedVersion = true; ? But even it is that's the case, how do you excecute upload.swf without flash? My getround would be writing a static html for uploading Iphone version of site? Quote Link to post Share on other sites
sskl 3 Posted April 23, 2010 Report Share Posted April 23, 2010 Well, mine would be a little more extreme. Instead of using flash as a gateway to upload the file, write a html page that will do exactly the same thing. This will save a lot of headache. Of course, another way would be tampering around with the javascript, which takes up hella lotsa time. Again, once you figure out which function does this and which functions pass the variable back to processing script, you can create another static html or custom javascript that does the same thing. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.