Hi Aran and SWFObject team. I sent the modification to SWFObject (below) a while back and didn't see any responses sent to the list. Is it something you may be interested in formally supporting?
My revision allows you to easily bring *all* query string name/value pairs from the URL into Flash. Advantages over getQueryParamValue: -- You don't have to know the query string variable names in advance -- You don't need a separate line of code for each variable you're importing. This provides a quick and easy way of bringing in *all* the variables at once. -- No errors from spelling mistakes in the param names listed in the getQueryParamValue method. -- Updates to your SWF don't require updates to your HTML to accommodate new or changed variable names. Elliot Mebane Principal, Zero G Games http://www.zeroggames.com/reel/ [email protected] 310.237.6629 x104 -----Original Message----- From: ElliotMebane [mailto:[email protected]] Sent: Wednesday, November 19, 2008 12:58 AM To: SWFObject Subject: Revised SWFObject--Populate flashvars with all query string pairs I've made the following update to swfobject.js. It is similar to getQueryParamValue except that rather than specifying the query variable to retrieve, this function returns an Object populated with all the name/value pairs from the query string. The advantage of this is that you don't have to specify what name/ value pairs to expect. I've tested this in all my Windows XP browsers and it works. Will the SWFObject team review the code, revise as necessary for cross- browser and cross-platform compatibility, and consider including this new function in the next release of SWFObject? I think it would be helpful for the community. To avoid collisions with other variables, I created new variables starting with ba, bb, bc... I'm sure that the SWFObject owners can advise about the best variable names to use instead. New SWFObject function: getQueryAsObj:function(){var ba=K.location.search||K.location.hash;var bd={};if(ba){var bb=ba.substr(1).split('&');for(var bc=0;bc<bb.length;bc++){bd[g(bb[bc].substring(0,bb[bc].indexOf('=')))] =g(bb[bc].substr(bb[bc].indexOf('=')+1))}}return bd} To use the new function, rather than assigning an empty Object to the flashvars variable in the script section of the HTML page, assign the results of the getQueryAsObj function to the flashvars variable. Additional name/value pairs can still be added to the flashvars Object. EX: var flashvars = swfobject.getQueryAsObj(); Here is a functional example and downloadable source files: http://www.zeroggames.com/lab/flashVars/flashVarsTest.html?queryName1=queryV alue1&queryName2=queryValue2&queryName3=queryValue3 Elliot Mebane Principal, Zero G Games Adobe Community Expert [email protected] No virus found in this incoming message. Checked by AVG. Version: 7.5.549 / Virus Database: 270.9.6/1797 - Release Date: 11/18/2008 11:23 AM No virus found in this outgoing message. Checked by AVG. Version: 7.5.552 / Virus Database: 270.10.6/1888 - Release Date: 1/12/2009 7:04 AM --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SWFObject" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/swfobject?hl=en -~----------~----~----~----~------~----~------~--~---
