PDA

View Full Version : set variable using html link



jazzman121
May 22nd, 2003, 10:40 AM
say i have a flash file.. which checks the value of a variable... if the value is true then it does something and if the value is false it does something else....

my question is ,,... can i set that variable value... from a link to the html page which has that flashfile embedded in it


hope that makes sense

Stephen
May 22nd, 2003, 11:59 AM
yes you can after the link to the swf files in the html page(theres two of them) you can add xxxx.swf?variableName=variableValue

Where variableName is the name of the variable and variableValue is the value of the variable. In your movie you then have a variable called variableName that you can use as a normal variable

jazzman121
May 22nd, 2003, 12:03 PM
i knwo that... but what i want to do is... set the variable just using a link soo when i click the link it sets the variable to a value

and when i click another link it goes to the same page same swf buttt different variable value....

Stephen
May 23rd, 2003, 08:44 AM
that depends on what kind of webserver you are working on.

You can add parameters to the end of a url in the following format

www.kirupa.com?myVariable=myValue1

On the page that holds your calll to the swf you need to put some code to grab the parameter and pass it into the call to the swf. (At work I use a java based webserver so this is pretty easy to do) ie

myVar = request.getParameter(myVariable)


and then the call to the swf would be

"mySwf.swf?myVariable=" + myVar

where myVar is the variable. Otherwise your stuck to having the links point to different pages all calling the same swf but passing in parameters

jazzman121
May 29th, 2003, 03:52 PM
can u show me the exact code... for using javascript to send the variable from the link to the swf??

and what exactly do u mean by a java based web serever?