# GetUrl and Variables problem

**URL:** <https://forum.kirupa.com/t/geturl-and-variables-problem/42005>\
**Category:** flash\
**Created:** [February 4, 2004, 3:10am UTC](https://forum.kirupa.com/t/geturl-and-variables-problem/42005 "2004-02-04T03:10:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chubob](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/chubob/32/368_2.png) [@chubob](https://forum.kirupa.com/u/chubob)\
**Post date:** [February 4, 2004, 3:10am UTC](https://forum.kirupa.com/t/geturl-and-variables-problem/42005/1 "2004-02-04T03:10:51Z")

</div>

Hey guys, I’ve got a silly problem with actionscripting.  
I have o button on stage, and I want to add an action to this button by actionscripting. The action will tell the button to open a webpage BUT the URL will be in a variable so the code is:[AS]button.onRelease = function() {  
getURL(\_root.mylink);  
};[/AS]Now, I will set the value of the variable. The problem is that I want the URL to open in a “\_blank” Window. I’ve tried this:[AS]\_root.mylink = “[http://www.sampleurl.com](http://www.sampleurl.com)”, “\_blank”;[/AS]… can somebody tell me what’s wrong with setting the variable? every time a click the button it takes me to the webpage, but in the main window - not in a pop.  
If I were not using variables the code should be like this[AS]getURL(“[http://www.sampleurl.com](http://www.sampleurl.com)”, “\_blank”);[/AS]:h:

---

<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:** [February 4, 2004, 3:32am UTC](https://forum.kirupa.com/t/geturl-and-variables-problem/42005/2 "2004-02-04T03:32:44Z")

</div>

Hi there

I couldn’t get it to work as a variable either. I’d throw in a javascript link  
[AS]\_root.mylink = "javascript:popUp(‘[http://www.sampleurl.com](http://www.sampleurl.com)’)"  
button.onRelease = function() {  
getURL(\_root.mylink);  
};  
[/AS]  
and the corresponding javascript in the html page

```php
<script>
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,menubar=1,resizable=1,width=685,height=480,left = 192,top = 70');");
}
</script>

```

The javascript works in the variable. I don’t know why, but in my actionscript showing the variable in this post, is replacing the word 'javascript ’ with the word ‘about’! Who knows?

---

<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:** [February 4, 2004, 8:45pm UTC](https://forum.kirupa.com/t/geturl-and-variables-problem/42005/3 "2004-02-04T20:45:15Z")

</div>

Or…  
[AS]button.onRelease = function() {  
getURL(\_root.mylink, \_root.mylinkwhere);  
};  
\_root.mylink = “[http://www.sampleurl.com](http://www.sampleurl.com)”; //edit…  
\_root.mylinkwhere = “\_blank”;  
[/AS]

---

<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:** [February 4, 2004, 9:36pm UTC](https://forum.kirupa.com/t/geturl-and-variables-problem/42005/4 "2004-02-04T21:36:22Z")

</div>

That’s a much better solution chubob!:ne:
