# How to gain control over link targets (not getURL action) in my script?

**URL:** <https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495>\
**Category:** Uncategorized\
**Created:** [August 5, 2004, 11:29pm UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495 "2004-08-05T23:29:48Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lunasol](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@Lunasol](https://forum.kirupa.com/u/Lunasol)\
**Post date:** [August 5, 2004, 11:29pm UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/1 "2004-08-05T23:29:48Z")

</div>

[size=2]I’m just a starter in Flash, that’s why I downloaded some menu-movies from flashkit to adapt and learn from.

My problem is (and I’m really a know-nothing about action script) how to gain control over the targets of the links in this menu. Now all links open in a new browser window, but I want most of them to open in the same window.I only know how to set the \_self and \_blank targets with getURL, but I don’t know how to do this in this script.

Also how do I make one of the links a direct email-link?

I entered [mailto:xxx@z.com](mailto:xxx@z.com) (but a valid address in my real movie) and it does open an email window, but it also opens a browser window saying they can’t find mailto:xxx etc. How do I stop that browser window from opening too?

If you could help me, that would be great. I love the movie, it’s exactly what I wanted!!

Thanx in advance,

Angie

Relevant part of script:

links = new Array();  
links[0] = “[http://www.xxx.com/index.html](http://www.xxx.com/index.html)”;  
links[1] = “[http://www.xxx.com/agenda.html](http://www.xxx.com/agenda.html)”;  
links[2] = “[mailto:xxx@z.com](mailto:xxx@z.com)”;

etc  
[/size]

---

<div class="post-metadata">

**Author:** ![allaKAZAAM](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@allaKAZAAM](https://forum.kirupa.com/u/allaKAZAAM)\
**Post date:** [August 6, 2004, 1:18am UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/2 "2004-08-06T01:18:38Z")

</div>

:puzzle: WELL!

I had…that is HAD…the same issue (see my post earlier today!). And was given the same problem solution as you have written down.

The “getURL” I find does the same thing…opens 2 pages…one with the Email user window and the other giving an error…  
TRY and use my original coding (this is what I used instead…

[font=Comic Sans MS][color=#003366]on (release) {  
loadVariablesNum("[/color][/font][[font=Comic Sans MS]mailto:info@!!!.com[/font]](mailto:info@!!!!!!!!!!!.com)[font=Comic Sans MS][color=#003366]", 0);  
}[/color][/font]  
[font=Comic Sans MS][color=#003366][/color][/font]  
[font=Comic Sans MS][color=#003366]And this works BEAUTIFULLY! I was able to also use the advice of “2nd Day” and manipulate the Subject field too! (just see my post!).[/color][/font]  
[font=Comic Sans MS][color=#003366][/color][/font]  
[font=Comic Sans MS][color=#003366]Hope this helps![/color][/font]  
[font=Comic Sans MS][color=#003366][/color][/font]  
[font=Comic Sans MS][color=#003366]allaKAZAAM[/color][/font]

---

<div class="post-metadata">

**Author:** ![Lunasol](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@Lunasol](https://forum.kirupa.com/u/Lunasol)\
**Post date:** [August 6, 2004, 4:44pm UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/3 "2004-08-06T16:44:08Z")

</div>

Well, AllaKazaam, I did read your threads before I posted my question (hell, I’ve read every forum so to speak), but I can’t use that, because mine is not a button instance nor movie clip, I think, I don’t have separate buttons for all the links. I have sort of templates that are used in the scene and the AS changes the link-text inside the button each time. That’s why I said “not GetURL” in my topic :). Or maybe I should do it that way but I don’t know how to add that in the script.

Thanx anyway!

Anyone else?

---

<div class="post-metadata">

**Author:** ![ahmed](https://avatars.discourse-cdn.com/v4/letter/a/8c91f0/32.png) [@ahmed](https://forum.kirupa.com/u/ahmed)\
**Post date:** [August 6, 2004, 4:58pm UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/4 "2004-08-06T16:58:46Z")

</div>

mytextbox.html = true;  
mytextbox.htmlText = “\<a target=”\_blank" href=“[www.kirupa.com](http://www.kirupa.com)”\>Kirupa!\</a\>";

---

<div class="post-metadata">

**Author:** ![Lunasol](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@Lunasol](https://forum.kirupa.com/u/Lunasol)\
**Post date:** [August 6, 2004, 6:00pm UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/5 "2004-08-06T18:00:36Z")

</div>

> [@ahmed](#):
>
> mytextbox.html = true;  
> mytextbox.htmlText = “\<a target="\_blank" href="www.kirupa.com"\>Kirupa!\</a\>”;

Frustrating, but I can’t figure out how to do that, again :sigh: …  
The name for the link is defined in another array (‘titel’ is the main link, ‘n’ is amount of sublinks, ‘fields’ is the name of the sublinks, ‘links’ is the url which opens in a new window each time, which I want to change). I tried adding \_self to the links in all kind of ways, but it doesn’t help. I either get an error or it tries adding it to the url (like: [http://www.lalala.com/index.html%20\_self](http://www.lalala.com/index.html%20_self) etc.). I don’t know enough about variables and expressions and all that, but I really want to learn how it works.  
I also couldn’t prevent a browser window from opening in the email link, I tried adding 0… God, I’m hopeless, still so much to learn 😊 .

Here’s the code (in total):

\<code\>  
titel = new Array();  
titel[0] = “home”;  
titel[1] = “on\_tour”;  
titel[2] = “profile”;  
titel[3] = “ear and eye”;  
titel[4] = “extras”;  
titel[5] = “promotion”;  
titel[6] = “bookings”;  
titel[7] = “guestbook”;  
titel[8] = “email”;  
titel[9] = “latest\_shows”;  
n = new Array();  
n[0] = 1;  
n[1] = 2;  
n[2] = 5;  
n[3] = 3;  
n[4] = 5;  
n[5] = 3;  
n[6] = 1;  
n[7] = 1;  
n[8] = 1;  
n[9] = 4;  
fields = new Array();  
fields[0] = “back\_to\_start”;  
fields[1] = “upcoming\_shows”;  
fields[2] = “shows\_history”;  
fields[3] = “Hayo \> bass”;  
fields[4] = “Erik \> guitars”;  
fields[5] = “Duijf \> vocals”;  
fields[6] = “Remco \> drums”;  
fields[7] = “Thijs \> guitars”;  
fields[8] = “audio”;  
fields[9] = “video”;  
fields[10] = “pictures”;  
fields[11] = “printed\_media”;  
fields[12] = “setlists”;  
fields[13] = “studio\_sessions”;  
fields[14] = “London\_trip”;  
fields[15] = “Flip\_fans”;  
fields[16] = “promo\_cd”;  
fields[17] = “t\_shirts”;  
fields[18] = “promo\_material”;  
fields[19] = “bookings\_form”;  
fields[20] = “view\_or\_sign”;  
fields[21] = “email\_FtS”;  
fields[22] = “10-07 Amsterdam”;  
fields[23] = “12-06 Vlaardingen”;  
fields[24] = “11-06 Heemskerk”;  
fields[25] = “more\_shows”;  
links = new Array();  
links[0] = “index.html”;  
links[1] = “agenda.html”;  
links[2] = “[mailto:xxx@z.com](mailto:xxx@z.com)”;  
links[3] = “x”;  
links[4] = “x”;  
links[5] = “x”;  
links[6] = “x”;  
links[7] = “x”;  
links[8] = “x”;  
links[9] = “x”;  
links[10] = “x”;  
links[11] = “x”;  
links[12] = “x”;  
links[13] = “x”;  
links[14] = “x”;  
links[15] = “x”;  
links[16] = “x”;  
links[17] = “x”;  
links[18] = “x”;  
links[19] = “x”;  
links[20] = “x”;  
links[21] = “x”;  
links[22] = “x”;  
links[23] = “x”;  
links[24] = “x”;  
links[25] = “x”;  
\</code\>

Thanx everyone for trying to help me out here, I’m really stuck!

---

<div class="post-metadata">

**Author:** ![Lunasol](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@Lunasol](https://forum.kirupa.com/u/Lunasol)\
**Post date:** [August 7, 2004, 12:13am UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/6 "2004-08-07T00:13:48Z")

</div>

I changed:  
links[0] = “[index.html](http://members.chello.nl/e.zevenbergen/bios/remco.html)”;

to:  
links[0] = getURL(“index.html”, “\_self”);

And it works (opens the index.html in same browser window), but it goes there as soon as the page with the swf loads, instead of when I click the appropiate sublink, so I need to insert something like onRelease, but where and how??

Can anybody help? Pleeeeezzz? Pretty pleeeezz?? :ne:

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [August 7, 2004, 7:35am UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/7 "2004-08-07T07:35:28Z")

</div>

Open your mc “fields” and click the “copia” button. Change the code there to

```auto
on(release){
	_root.spegni1();
	gotoAndStop(5);
    getURL(link,"_self");
}

```

scotty(-:

---

<div class="post-metadata">

**Author:** ![Lunasol](https://avatars.discourse-cdn.com/v4/letter/l/58956e/32.png) [@Lunasol](https://forum.kirupa.com/u/Lunasol)\
**Post date:** [August 7, 2004, 3:44pm UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/8 "2004-08-07T15:44:07Z")

</div>

O jeez, I totally forgot about that!! OOps! Mental note to self: Never post if you’re lacking sleep… Thanx again Scotty :).

---

<div class="post-metadata">

**Author:** ![scotty](https://avatars.discourse-cdn.com/v4/letter/s/91b2a8/32.png) [@scotty](https://forum.kirupa.com/u/scotty)\
**Post date:** [August 7, 2004, 6:25pm UTC](https://forum.kirupa.com/t/how-to-gain-control-over-link-targets-not-geturl-action-in-my-script/118495/9 "2004-08-07T18:25:32Z")

</div>

welcome;)
