Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pass a variable

Status
Not open for further replies.

Lladro

Programmer
Mar 5, 2007
18
US
Good Morning All!

I am a newbie in Flash 8, ActionScript 2.0. I need to pass a variable that was supplied to me via the URL through all my pages in Flash. How can I do this?

Please Help!

Lladro
 
This is purely a JavaScript job. The strategy will be first extract the variables from the URL, then secondly pass them to Flash using FlashVars. I recommend to use SWFObject < to embed Flash in your HTML. If you use SWFObject, the Javascript would be something like:
Code:
<script type="text/javascript">
   var so = new SWFObject("flashvars.swf", "flash", "320", "240", "8", "#ffffff");
   var vars = window.location.search.substr(1).split("&");
   for(var i = 0, n = vars.length; i<n; i++){
      var a = vars[i].split("=");
      so.addVariable(a[0], a[1]);
   }
   so.write("flash");
</script>

Kenneth Kawamoto
 
Ken,

I will try this, but I have a question? Is there a way to do a session variable?

I appreciate ALL your help!

Thank you.

Lladro
 
> Is there a way to do a session variable?

Your server app can generate a HTML Flash object/embed tag on the fly with FlashVars which are taken from the ession variables. Or Flash can call your server app to retrieve the session variables.

Kenneth Kawamoto
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top