# Flash and html communication

**URL:** <https://forum.kirupa.com/t/flash-and-html-communication/263896>\
**Category:** flash\
**Created:** [June 20, 2008, 7:48am UTC](https://forum.kirupa.com/t/flash-and-html-communication/263896 "2008-06-20T07:48:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![fido\_glc](https://avatars.discourse-cdn.com/v4/letter/f/3da27b/32.png) [@fido\_glc](https://forum.kirupa.com/u/fido_glc)\
**Post date:** [June 20, 2008, 7:48am UTC](https://forum.kirupa.com/t/flash-and-html-communication/263896/1 "2008-06-20T07:48:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![actionAction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/actionaction/32/3987_2.png) [@actionAction](https://forum.kirupa.com/u/actionAction)\
**Post date:** [June 21, 2008, 2:45am UTC](https://forum.kirupa.com/t/flash-and-html-communication/263896/2 "2008-06-21T02:45:04Z")

</div>

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:

```auto

<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]

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

```

[FONT=monospace]

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

```auto

_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]
