# Javascript -\> AS3 Problem

**URL:** https://forum.kirupa.com/t/javascript-as3-problem/291929
**Category:** flash
**Created:** [July 7, 2009, 7:42pm UTC](https://forum.kirupa.com/t/javascript-as3-problem/291929 "2009-07-07T19:42:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![CoreyWilson](https://avatars.discourse-cdn.com/v4/letter/c/4491bb/32.png) [@CoreyWilson](https://forum.kirupa.com/u/CoreyWilson)
#### Post date: [July 7, 2009, 7:42pm UTC](https://forum.kirupa.com/t/javascript-as3-problem/291929/1 "2009-07-07T19:42:09Z")

</div>

I’ve been trying to tackle this problem for hours now and am becoming ever more frustrated.

I have a flash file that takes up the entire browser window, except for the bottom of the window where I have HTML Buttons that on rollover were meant to trigger animations on the island.

Basically there are 7 buildings on the flash file that when hovered over create a glow effect, these buttons are related to the HTML Buttons which when rolled over are suppose to trigger each other (rollover a building, the corresponding HTML button looks pressed in, and vice versa)

Unfortunately I can’t seem to get the Javascript to successfully call the Flash File, I have taken code online and reproduced it to no success.  
\*\*  
In the Flash File:\*\*

```auto

import flash.external.ExternalInterface;

var all:Array = new Array(greencenter,yogacenter,mediacenter,metaphysicalcenter,travelcenter,shoppingcenter,wellnesscenter);

ExternalInterface.addCallback('sendTextToFlash', getTextFromJavaScript);
function getTextFromJavaScript(str):void {
    all[str].gotoAndPlay(2);
    water.alpha = 1;
}
// The water.alpha = 1 was an attempt to make (Anything appear but neither are working)

```

**In the javascript file:**

```auto

$(document).ready(function(){
        $(".green > a").hover(function(){ setCurrentPage(1); });
    function setCurrentPage(newPage) {
        SendDataToFlashMovie(newPage);
    }
        
    function getFlashMovieObject(movieName){
        if (window.document[movieName]){
            return window.document[movieName];
        }
        if (navigator.appName.indexOf('Microsoft Internet')==-1){
            if (document.embeds && document.embeds[movieName])
                return document.embeds[movieName];
            }
                else // if (navigator.appName.indexOf(”Microsoft Internet”)!=-1)
            {
                return document.getElementById(movieName);
            }
        }
        
        function SendDataToFlashMovie(newPage){
            var flashMovie=getFlashMovieObject('island');
            alert(flashMovie);
            flashMovie.sendTextToFlash(newPage);
        }
    });
// This is successfully alerting the flashMovie as far as I can tell.

```

**This is in the HTML:**

```auto

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%" id="island" title="island">
              <param name="movie" value="fla/site.swf" />
              <param name="quality" value="high" />
              <param name="wmode" value="opaque" />
              <param name="swfversion" value="6.0.65.0" />
              <param name="expressinstall" value="js/expressInstall.swf" />
              <!--[if !IE]>-->
              <object type="application/x-shockwave-flash" data="fla/site.swf" width="100%" height="100%">
                <!--<![endif]-->
                <param name="quality" value="high" />
                <param name="wmode" value="opaque" />
                <param name="swliveconnect" value="true" />
                <param name="swfversion" value="6.0.65.0" />
                <param name="expressinstall" value="js/expressInstall.swf" />
                <!--[if !IE]>-->
              </object>
              <!--<![endif]-->
            </object>

```

I’ve been trying different things for hours but something isn’t connecting properly and I am at a loss to what. Does anyone see anything missing!?

HELP!
