Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

ActionScript 3 - Navigate to URL

Featured Replies

Hi all,

 

I am new to Actionscript and have followed a tutorial chapter entitled "Creating Interactive Navigation" from the Adobe Flash CS4 CLASSROOM IN A BOOK series.

 

All is going well at this point. I know Flash itself pretty well.

 

I have six thumbnails across the top of the page. When I click on a top thumbnail, its image shows up larger in the main panel below. That's it, very nice and simple.

 

I would like to take it one step further though.

 

I have added two buttons alongside one of the images in the main panel itself, and would like to make it so that when a button is clicked, a new browser opens and you are taken to a URL e.g. Google's home page.

 

I have tried to do this myself but I just can't get it to work.

 

This forum will not let me upload my FlashCS4 file so I was hoping I could email it over to someone so they could throw in the few lines of Actionscript - test to make sure the SWF works - and then send it back over to me to see how it works.

 

It should be dead simple for someone who know what they are doing.

 

The file is complete with buttons ready-made even with instance names. I just need the AS in there to make it work.

 

Hope there is someone who can help me.

 

Thanks a lot.

I'll have a look if you want but not promising anything. I've done the same thing no probs elsewhere though.

  • Author

Hi josoap,

 

Just to let you know I have successfully worked it out.

 

I knew I was missing something simple - I just needed to put the code in the corresponding actionscript keyframe to where the button sits on the timeline. Below is my finished code which works like a charm.

 

Thanks again for taking the time to answer and offer to help.

 

 

googleButton_btn.addEventListener(MouseEvent.CLICK, buttonClicked1);

 

function buttonClicked1(event:MouseEvent):void

{

var buttonClicked1:URLRequest = new URLRequest("http://www.google.co.uk");

navigateToURL(buttonClicked1, "_blank");

}

 

yahooButton_btn.addEventListener(MouseEvent.CLICK, buttonClicked2);

 

function buttonClicked2(event:MouseEvent):void

{

var buttonClicked2:URLRequest = new URLRequest("http://www.yahoo.co.uk");

navigateToURL(buttonClicked2, "_blank");

}

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.