Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Passing values in querystring of url...

Posted on 2007-04-02
5
399 Views
Last Modified: 2012-06-27
I need to use variables passed in the query string of the page in my flash movie but am having a tough time implementing the code properly.  Is there no actionscript that allows you to have access to the query string directly?

It seems that you need to hard code values into the query string in most of the examples I have seen.  For instance they say you should do this:

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
  codebase="http://download.macromedia.com/"  
  WIDTH="250" HEIGHT="300" id="movie">
  <PARAM NAME=movie VALUE="movie.swf?myvar=variable1">
  <PARAM NAME=quality VALUE=high>
  <PARAM NAME=bgcolor VALUE=#FFFFFF>
  <EMBED src="movie.swf?myvar=variable1"
    quality=high bgcolor=#FFFFFF WIDTH="250" HEIGHT="250" NAME="flaMovie1"
    TYPE="application/x-shockwave-flash"
    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">
  </EMBED>
</OBJECT>

But this seems like it is hardcoding what the query string values are.  So if you visit the webpage with this swf embedded in it with this value:

www.mywebsite.com/movie.swf?myvar=differentValue

Than the movie wouldnt pick up the different value of myvar.  Or maybe I am missing something.  It also doesnt help that any time I change the movie and embed values in my object tab (ie from movie.swf to movie.swf?myvar=$value1) I get a security exception with flash player and it wont let me call the webservice from a different domain...
0
Comment
Question by:wildbrookmedia
  • 3
  • 2
5 Comments
 
LVL 1

Expert Comment

by:Fern2
ID: 18842841
Use this:
<PARAM NAME=FlashVars VALUE="myvar=variable&myvar1=variable1&myvar2=variable2">

Then when the movie loads you can trace the variables.

trace(myvar);
outout: variable
trace(myvar1);
outout: variable1
trace(myvar2);
outout: variable2
0
 
LVL 1

Accepted Solution

by:
Fern2 earned 250 total points
ID: 18842865
If you are using JSP, Coldfusion or some other serverside scriptiing then your can pass your URL parameters to the "flashvars" when the page is created.

If your are just using basic HTML, then you can use Javascript to pass the URL parameters to the "flashvars".
0
 
LVL 8

Author Comment

by:wildbrookmedia
ID: 18844363
I think your first post makes it so that the parameters are always the same values.  (ie the flash movie doesnt really look at the query string for the variables)

I will have to look into javascript I think...
0
 
LVL 1

Expert Comment

by:Fern2
ID: 18844804
thats my point, you can set the "flashvars" with javascript.

 
0
 
LVL 8

Author Comment

by:wildbrookmedia
ID: 18845539
for those that browse this question later, the best javascript example I found was here:

http://www.noscope.com/journal/2003/12/query_string
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Text To Speech Reader For Adobe Flash Pages 4 930
Download Adobe Flash Player 6 67
Adobe Flash Player ActionScript error 6 66
Flash ActionScript 6 57
This is a very simple example to help those of you who are still migrating from AS2 to AS3 understand the redesigned event model in AS3. In AS2.0, event functions (that is, the function to be performed when an event is fired) were stored as a pro…
While working over numerous projects I often had the requirement for doing a screen capture in AS3.0. Unfortunately I found no "ready made" solutions in google search that suited my requirements. But I did come across some great resources which help…
The goal of the tutorial is to teach the user how to how to load their YouTube profile onto Flash Media Live Encoder.
The goal of the tutorial is to teach the user how to select which audio input to use. Once you have an audio input plugged into the laptop or computer, you will go into the audio input settings and choose which audio input you want to use.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question