Code for Flash to load .html, or other media

If you want to have Flash link to an external site, or use Flash for navigation, it is a two step process.

  1. Tell Flash where to go
  2. Tell Flash to go there

Part 1:  Tell Flash where to go:

In the following code, we are creating a new variable called “link1″, and then defining the destination, which is called “page1.html”.

var link1:URLRequest = new URLRequest("page1.html");

Part 2:  Tell Flash to go there:

In the following code, we tell Flash to go to this destination, by “navigating” to the URL (the variable that you defined in part 1.

navigateToURL(link1, "_self");

Notice how in part two we use the same variable name (link1) in both parts. Often part 2 is found in a function, called by clicking on a button/movieclip button.

Remember that for each link you have, it is a two step process.  Make sure to use unique variable names, and to change the destination when copying/pasting for different links.

Below you will find an example file of a Flash nav with 3 links that go to “page1.html”, “page2.html”, and “page3.html”.  If you look at the actions I have commented the code to explain each section.

flashLinkexample

 
 
copyright © 2004 - 11 cawd by steven herr. all rights reserved