Flash and html communication

I have a site with 2 pages: “page1.html” and “page2.html”.

“page1.html” has html content and a menu with 5 buttons.

“page2.html” has a swf file embedded which has 5 pages.

When the user clicks one of the 5 buttons in page1.html the browser has to go to page2.html and the flash there has to go the page corresponding to the selected button.

How can I tell flash which button the user pressed in page1.html ?

Thank you.

PHP will do the trick (if you have access to PHP on your server)!

Change your links in your page1.html page to follow this protocol:


<a href="page2.html?page=1">Page 1</a>
<a href="page2.html?page=2">Page 2</a>
<a href="page2.html?page=3">Page 3</a>
...

[FONT=monospace]In your embed, where it says the name of the swf have something like this:

[/FONT]

my_swf.swf?page=<?php echo $_GET['page']; ?>

[FONT=monospace]

Now within your flash movie, you can access this as a variable called page.


_root.onLoad = function()
{
   switch(page)
   {
      case 1: gotoAndStop("page1area");
              break;
      case 2: gotoAndStop("page2area");
              break;
      ...//and so on
      default: gotoAndStop(1);
               break;
   }
}

Hope this helps, I am a little rusty on my flash stuff.
[/FONT]