# Variable in a link?

**URL:** <https://forum.kirupa.com/t/variable-in-a-link/185044>\
**Category:** Uncategorized\
**Created:** [April 10, 2006, 3:06pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044 "2006-04-10T15:06:34Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pvtpyro](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pvtpyro/32/1364_2.png) [@pvtpyro](https://forum.kirupa.com/u/pvtpyro)\
**Post date:** [April 10, 2006, 3:06pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/1 "2006-04-10T15:06:34Z")

</div>

Here’s my actionscript so far

```auto
_txt.text = id;

```

when i put in a link i did this:

[http://mylink.com/somefolder/\_txt](http://mylink.com/somefolder/_txt)

it’s not working.  
what do i need to do to get the variable in the link. if that made sense?

---

<div class="post-metadata">

**Author:** ![pvtpyro](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pvtpyro/32/1364_2.png) [@pvtpyro](https://forum.kirupa.com/u/pvtpyro)\
**Post date:** [April 10, 2006, 3:27pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/2 "2006-04-10T15:27:44Z")

</div>

on (press) {

```
//Goto Webpage Behavior
getURL("http://mylinkishere.com/[COLOR=RoyalBlue]_txt[/COLOR]","_self");
//End Behavior

```

}

i’m not sure what goes around the blue. I’ve tried quotes, slashes… is the whole thing wrong? it works fine with text fields

---

<div class="post-metadata">

**Author:** ![RichL](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@RichL](https://forum.kirupa.com/u/RichL)\
**Post date:** [April 10, 2006, 3:36pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/3 "2006-04-10T15:36:54Z")

</div>

Unless i’m missing the point won’t the following work…

```auto
 
getURL("[http://mylinkishere.com/"+_txt.text,"_self](http://mylinkishere.com/)");

```

Also it might be a good idea to create a variable for the link…

```auto

var myLink:String = "http://mylinkishere.com/"+_txt.text;
...
getURL(myLink,[COLOR=#003366]"_self[/COLOR]");

```

---

<div class="post-metadata">

**Author:** ![pvtpyro](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pvtpyro/32/1364_2.png) [@pvtpyro](https://forum.kirupa.com/u/pvtpyro)\
**Post date:** [April 10, 2006, 3:53pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/4 "2006-04-10T15:53:54Z")

</div>

cool my variable showed up! that’s progress. Do you happen to know how to get rid of the single quotes that keep showing up on the outside

---

<div class="post-metadata">

**Author:** ![RichL](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@RichL](https://forum.kirupa.com/u/RichL)\
**Post date:** [April 10, 2006, 4:02pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/5 "2006-04-10T16:02:19Z")

</div>

I’m not sure what you mean.

Can you post your fla??

---

<div class="post-metadata">

**Author:** ![pvtpyro](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pvtpyro/32/1364_2.png) [@pvtpyro](https://forum.kirupa.com/u/pvtpyro)\
**Post date:** [April 10, 2006, 4:18pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/6 "2006-04-10T16:18:14Z")

</div>

I dont have a host to post my fla right now… but

my as:

\_txt.text = id;

on (release) {

```
//Goto Webpage Behavior
getURL("http://mylink/"+_txt.text,"_self");
//End Behavior

```

}

then in the browser it shows up as [http://mylink/[COLOR=“Red”]’[/COLOR]myvariablenumbersarehere[COLOR=“Red”]’[/COLOR]](http://mylink/%5BCOLOR=%22Red%22%5D'%5B/COLOR%5Dmyvariablenumbersarehere%5BCOLOR=%22Red%22%5D'%5B/COLOR%5D)

All I need to do is get rid of the single quotes before and after my variable.

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 10, 2006, 4:21pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/7 "2006-04-10T16:21:30Z")

</div>

maybe try eval()

```auto
on (release) {

//Goto Webpage Behavior
getURL("http://mylink/"+eval(_txt.text),"_self");
//End Behavior

}

```

---

<div class="post-metadata">

**Author:** ![pvtpyro](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pvtpyro/32/1364_2.png) [@pvtpyro](https://forum.kirupa.com/u/pvtpyro)\
**Post date:** [April 10, 2006, 4:28pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/8 "2006-04-10T16:28:08Z")

</div>

It got rid of the quotes, but now it’s not seeing my variable at all.  
[http://mylink/undefined](http://mylink/undefined)

Sorry about this. ☹

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [April 10, 2006, 4:36pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/9 "2006-04-10T16:36:52Z")

</div>

lol… np. Maybe try this:

```auto
var myLink:String = eval("http://mylinkishere.com/"+_txt.text);
on (release) {

//Goto Webpage Behavior
getURL(myLink,"_self");
//End Behavior

}

```

---

<div class="post-metadata">

**Author:** ![pvtpyro](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pvtpyro/32/1364_2.png) [@pvtpyro](https://forum.kirupa.com/u/pvtpyro)\
**Post date:** [April 10, 2006, 4:54pm UTC](https://forum.kirupa.com/t/variable-in-a-link/185044/10 "2006-04-10T16:54:39Z")

</div>

I got a couple errors with that one.

so far the closest I got was this:

on (release) {

```
//Goto Webpage Behavior
getURL("http://mylink/" + id,"_self");
//End Behavior

```

}

it adds single quotes before and after my variable.
