# JavaScript to Flash with layers

**URL:** https://forum.kirupa.com/t/javascript-to-flash-with-layers/196923
**Category:** flash
**Created:** [August 11, 2006, 9:32pm UTC](https://forum.kirupa.com/t/javascript-to-flash-with-layers/196923 "2006-08-11T21:32:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Neuhaus3000](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/neuhaus3000/32/168_2.png) [@Neuhaus3000](https://forum.kirupa.com/u/Neuhaus3000)
#### Post date: [August 11, 2006, 9:32pm UTC](https://forum.kirupa.com/t/javascript-to-flash-with-layers/196923/1 "2006-08-11T21:32:45Z")

</div>

Hello everyone,

I’m trying to make 2 movies on 2 different layers talk to each other. :puzzled:  
I can make my flash movie start a js function from my HTML page but I can’t make that function talk to the second movie.

In details…

In a html page, I have embeded a movie called **movie1.swf**.  
On a layer on that same page, I have an other movie called **movie2.swf**.

On a frame in my **movie1.swf** , I have a getURL calling a function.  
getURL(‘javascript:byebye()’);

The function called in the HTML page:  
\<script language=“JavaScript” type=“text/JavaScript”\>  
\<!–  
function byebye(){  
[INDENT]window.document. **movie2**.main.goToAndStop(“label\_called\_do\_something”);[/INDENT]  
}  
//–\>  
\</script\>

Here’s how the movies are EMBEDED in the HTML page:

\<object classid=“clsid:D27CDB6E-AE6D-11cf-96B8-444553540000” codebase=“[http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0](http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0)” name=“movie2” width=“900” height=“250” id=“movie2”\>  
[INDENT]\<param name=“movie” value=“movie2.swf” /\>  
\<param name=“quality” value=“high” /\>  
\<param name=“name” value=“movie2” /\>  
\<param name=“swLiveConnect” value=“true” /\>  
\<param name=“LOOP” value=“false” /\>  
\<embed src=“movie2.swf” width=“900” height=“250” loop=“false” quality=“high” pluginspage=“[http://www.macromedia.com/go/getflashplayer](http://www.macromedia.com/go/getflashplayer)” type=“application/x-shockwave-flash” name=“ant2” swLiveConnect=“true”\>\</embed\>[/INDENT]  
\</object\>  
\</div\>

\<object classid=“clsid:D27CDB6E-AE6D-11cf-96B8-444553540000” codebase=“[http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0](http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0)” width=“300” height=“250”\>  
[INDENT]\<param name=“movie” value=“movie1.swf” /\>  
\<param name=“quality” value=“high” /\>  
\<param name=“LOOP” value=“false” /\>  
\<embed src=“movie1.swf” width=“300” height=“250” loop=“false” quality=“high” pluginspage=“[http://www.macromedia.com/go/getflashplayer](http://www.macromedia.com/go/getflashplayer)” type=“application/x-shockwave-flash”\>\</embed\>[/INDENT]  
\</object\>

Any ideas why the function doesn’t make the movie2.swf go to main.goToAndStop(“label\_called\_do\_something”) ??? :h:

Any ideas will be appreciated…

Thanks! :thumb:

neuhaus3000
