This page require Adobe Flash 9.0 (or higher) plug in.

AS3: Scripting OnClick GetURL? (Where’s GetURL)

Another big suprise for AS3 is the missing GetURL where we used to script it on buttons to open up url. However that was replaced in ActionScript 3.0. We use navigateToURL instead.

Just follow the example when scripting your button. Remember like in previous tutorials, you need to add an eventlistener to your button to attached a function to it.

1
2
3
4
5
6
this.YourButton.addEventListener(MouseEvent.CLICK,openURL);
function openURL(event: MouseEvent)
{
	var request:URLRequest = new URLRequest("http://www.isgoodstuff.com");
	navigateToURL(request);
}

Other Cool Related Stuff

7 Comments so far »

  1. phoe chan said

    am February 27 2009 @ 5:46 pm

    Thank You Very Much
    :)

  2. Lisa said

    am March 9 2009 @ 9:42 pm

    Thank you so much! !

  3. iphone covers said

    am October 11 2009 @ 2:26 am

    How would I add that to this block? I keep getting an error;

    onClipEvent (load)
    {
    num = 5;
    this.title1.gotoAndStop(num);
    this.title2.gotoAndStop(num);
    this.title3.gotoAndStop(num);
    this.title4.gotoAndStop(num);
    }
    on (rollOver)
    {
    if (_root.link != num)
    {
    _root.menu2["item" + num].gotoAndPlay(“scontact”);
    this.gotoAndPlay(“scontact”);
    } // end if
    }
    on (releaseOutside, rollOut)
    {
    if (_root.link != num)
    {
    this.gotoAndPlay(“s2″);
    _root.menu2["item" + num].gotoAndPlay(“s2″);
    } // end if
    }
    on (release)
    {
    if (_root.link != num)
    {
    _root.link_prev = _root.link;
    _parent["item" + _root.link].gotoAndPlay(“s2″);
    _root.menu2["item" + _root.link].gotoAndPlay(“s2″);
    _root.link = num;
    } // end if

  4. Mr.GoodStuff said

    am October 13 2009 @ 10:13 am

    is because the script you are using is Actionscript 2.0. The ones im showing is Actionscript 3.0. The syntax and commands are all different. Thus, you get an error.

  5. 35mm slide scanner said

    am January 26 2010 @ 12:43 am

    thx for the script!

    Greetz

    Nick

  6. Systems said

    am May 26 2010 @ 10:21 am

    Why Give Me This Error ? The currently targeted Flash Player does not support the getURL action.
    getURL(_root.link, “”);
    The currently targeted Flash Player does not support the releaseOutside event. on (releaseOutside, rollOut)
    The currently targeted Flash Player does not support the releaseOutside event. on (releaseOutside, rollOut)
    etc if Anyone Know Please Post :D

  7. pawlo said

    am June 9 2010 @ 3:45 pm

    Thanx! Very nice and 100% ok code!

Comment RSS · TrackBack URI

Leave a comment

Name: (Required)

eMail: (Required)

Website:

Comment:

CommentLuv Enabled