# \[CS4\] HELP! fscommand not executing javascript function - AS2

**URL:** <https://forum.kirupa.com/t/cs4-help-fscommand-not-executing-javascript-function-as2/319317>\
**Category:** Uncategorized\
**Created:** [February 16, 2011, 5:38am UTC](https://forum.kirupa.com/t/cs4-help-fscommand-not-executing-javascript-function-as2/319317 "2011-02-16T05:38:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![emloam](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@emloam](https://forum.kirupa.com/u/emloam)\
**Post date:** [February 16, 2011, 5:38am UTC](https://forum.kirupa.com/t/cs4-help-fscommand-not-executing-javascript-function-as2/319317/1 "2011-02-16T05:38:14Z")

</div>

Hi all,

I’d be really grateful for some assistance. I really don’t have much of a clue what I’m doing here. I know some Flash basics but am really struggling with this. Have spent the last few days searching everywhere I can think of for a solution, but nothing I try is working. Am pretty sure the problem is me!!!

Here’s the trouble:  
I have an swf being played from an html page using the Javascript Shadowbox plugin. This is executed as soon as the window loads - creating a splashpage for the site. I am trying to get the swf to run the function Shadowbox.close(); as soon as the movie has finished playing without clicking the mouse or “doing” anything. I was previously using a timeout function on the html page to close the Shadowbox after a spcific length of time - but this does not allow for the time it takes for each users browser to download the swf.  
I decided it made more sense to use fscommand to execute the function I am after but I think my code must be screwed up because it will not work at all.

Here’s my page code:

```auto
<script type="text/javascript">
Shadowbox.init({
        skipSetup: true,
        modal: true,
        overlayColor: "#000000",
        overlayOpacity: 1,
        showMovieControls: false,
        viewportPadding: 0,
        flashVersion: "10.0.0",
        onClose: function(){$.fn.generalAnimation();}
} 
);
window.onload = function() {
    Shadowbox.open({
        content: '<object width="500" height="367" id="intromovie"><param name="intromovie" value="video/intromovie.swf"><embed src="video/intromovie.swf" width="500" height="367" menu="true" quality="best" play="false" name="intromovie" id="intromovie" type="application/x-shockwave-flash"></embed></object>',
        player: "html",
        width: 505,
        height: 375,
        modal: true,
    });
};
</script>
<script type="text/javascript">
function intromovie_DoFScommand(command, args) {
  if (command == "intromovie")
  {
       Shadowbox.close();
  }
}
</script>

```

And here’s my action script:

```auto

onClipEvent (load) {
    fscommand("intromovie");
}

```

The action script is attached to a single frame movie clip that is placed on the last frame of my swf.

I would be so grateful for help with this as am rapidly losing all patience!  
Many thanks in advance.  
Em.
