Here’s a very handy javascript function to grab FlashVars from the URL. ‘GUP’ Get URL Parameters can sit in your html or in an external js file.
function gup(name){ name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; }
And then when you create your SWF object, pass in the value name you are looking for (in this case ‘page’)
var so = new SWFObject("loader.swf?page="+gup('page'), ...
Hi – thanks for this solution – I’m no code-guy so i have no idea how to pass two variables in this way. Could you help?
Thanks again
Hi Rinus,
If you see my more recent post http://blog.sitedaniel.com/2008/12/flashvars-as3-getting-values-from-the-url-string/ there is an example there with more information
Cheers
Thank you! I have searching for it for 3 days and finally i found it. Thank you so much!!!