# Set variable using html link

**URL:** <https://forum.kirupa.com/t/set-variable-using-html-link/21514>\
**Category:** Uncategorized\
**Created:** [May 22, 2003, 2:40pm UTC](https://forum.kirupa.com/t/set-variable-using-html-link/21514 "2003-05-22T14:40:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazzman121](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jazzman121/32/127_2.png) [@jazzman121](https://forum.kirupa.com/u/jazzman121)\
**Post date:** [May 22, 2003, 2:40pm UTC](https://forum.kirupa.com/t/set-variable-using-html-link/21514/1 "2003-05-22T14:40:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 22, 2003, 3:59pm UTC](https://forum.kirupa.com/t/set-variable-using-html-link/21514/2 "2003-05-22T15:59:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 22, 2003, 4:03pm UTC](https://forum.kirupa.com/t/set-variable-using-html-link/21514/3 "2003-05-22T16:03:47Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 23, 2003, 12:44pm UTC](https://forum.kirupa.com/t/set-variable-using-html-link/21514/4 "2003-05-23T12:44:32Z")

</div>

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

> **[KIRUPA | become a better web developer](https://www.kirupa.com/?myVariable=myValue1)**
>
> With our thoughtfully clear, concise, and casual content, become a better (or more awesome) web developer really quickly!

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 29, 2003, 7:52pm UTC](https://forum.kirupa.com/t/set-variable-using-html-link/21514/5 "2003-05-29T19:52:45Z")

</div>

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?
