Skip to main content
Participant
September 26, 2006
Question

Send variable to Flash from HTML link

  • September 26, 2006
  • 7 replies
  • 490 views
Does anyone know if it's possible to include a variable in an html link <a> tag that can set a variable in Flash. I have used JavaScript to do this in the past but would prefer not to on this site. I also would prefer not have to use a server side script or xml, as all I want to do is set multiple links on one html page to open the same Flash movie on another html page, but make it go to a particular frame or load a particular external swf based on the link that was clicked. Thanks, JD
This topic has been closed for replies.

7 replies

JDRivesAuthor
Participant
September 26, 2006
One more question. How do I add the HTML page name and the Flash file name in the anchor tag? I need the link to open a new page with the Flash movie in it and then pass that variable. JD
JDRivesAuthor
Participant
September 26, 2006
Thanks Tim, I'll give it a try. JD
Inspiring
September 26, 2006

"JDRives" <webforumsuser@macromedia.com> wrote in message
news:efcb61$rkb$1@forums.macromedia.com...
> Do I need to use Flash Vars in the object and embed code to load them in
> or will they automatically be passed to the variable on the _root level of
> the SWF file? Thanks for your quick reply, JD

They automagically get passed.

So, what I typically do for testing is the following:

Based on expecting your query string to contain "myVar=myVal" then I do the
following,

if (myVar == undefined) {
myVar = "someval";
}

If your query string provides a value for myVar then it is used, otherwise
'someval' is used.



Inspiring
September 26, 2006
You need to use them in the object and embed tags.

--

Dan Mode
--> Adobe Community Expert
*Flash Helps* http://www.smithmediafusion.com/blog/?cat=11
*THE online Radio* http://www.tornadostream.com
*Must Read* http://www.smithmediafusion.com/blog


"JDRives" <webforumsuser@macromedia.com> wrote in message
news:efcb61$rkb$1@forums.macromedia.com...
> Do I need to use Flash Vars in the object and embed code to load them in
> or will they automatically be passed to the variable on the _root level of
> the SWF file? Thanks for your quick reply, JD


Participating Frequently
September 26, 2006
If you define the variable in the 1st frame on the main timeline then they will automatically get populated and you should be able to use them right away.

No other coding needed. :-)

Tim
JDRivesAuthor
Participant
September 26, 2006
Do I need to use Flash Vars in the object and embed code to load them in or will they automatically be passed to the variable on the _root level of the SWF file? Thanks for your quick reply, JD
Participating Frequently
September 26, 2006
<a href="flash.swf?variable=value&variable2=value2">Your link</a>

The variables will have to be on the main timeline (_level0) of your Flash movie.

Tim