Loading Browser Pages

I l @ ve RuBoard

Flash movies are often used as a substitute for HTML on Web sites. A Flash movie can be a front door to a Web site or a navigation bar that appears throughout the Web site. Either way, there are times when the movie will have to trigger the browser to load a new Web page.

Simple Loading

You can easily replace the Web page that the Flash movie is on. All it takes is a getURL command. Think of it as the equivalent to the <A HREF> tag in HTML. Here is a button that replaces the current page with another one:

 on (release) {     getURL("anotherpage.html"); } 

You can use a relative URL, as in the preceding example, or a complete absolute URL to direct the user to another Web site.

You also can direct the user to another Web site by using hypertext links in text fields. These work just like <A HREF> tags ”they actually are <A HREF> tags. They don't require any ActionScript code at all.

Targeted Loading

You can use a second form of the getURL tag to target a frame or window in the browser. If you have never used frames or windows in your HTML code, you probably don't need them. However, if you have used them, you know that frames and windows all have names . You can refer to a named frame or window by using a second parameter in the getURL command.

So if you are using frames and have the movie in a frame named Navigation and the content in a frame named Main, you could tell the frame Main to load the page summary.html with a button like this:

 on (release) {     getURL("summary.html","Main"); } 

You could do the same to target a window if it was named Main.

There are also four special targets that tell the browser to do special things. Here is a list:

  • _blank ” Creates a new window and loads the page there. The default window settings for a new window in the browser are be used.

  • _ parent ” Loads the page in the parent frame of the current frame.

  • _ top ” Loads the page in the current window, regardless of whether the movie is in a frame in the current window. It replaces the entire window contents ”all frames.

  • _ self ” Essentially the default behavior, with the contents of the current frame or window being replaced .

What if you want to create a new browser window that is not the default size and settings? You'll need to use JavaScript to do that. I'll explain later this hour .

I l @ ve RuBoard


Sams Teach Yourself Flash MX ActionScript in 24 Hours
Sams Teach Yourself Flash MX ActionScript in 24 Hours
ISBN: 0672323850
EAN: 2147483647
Year: 2002
Pages: 272

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net