# as3 calling a javascript function

**URL:** <https://forum.kirupa.com/t/as3-calling-a-javascript-function/303085>\
**Category:** flash\
**Created:** [January 13, 2010, 6:47pm UTC](https://forum.kirupa.com/t/as3-calling-a-javascript-function/303085 "2010-01-13T18:47:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tugboat](https://avatars.discourse-cdn.com/v4/letter/t/df705f/32.png) [@tugboat](https://forum.kirupa.com/u/tugboat)\
**Post date:** [January 13, 2010, 6:47pm UTC](https://forum.kirupa.com/t/as3-calling-a-javascript-function/303085/1 "2010-01-13T18:47:52Z")

</div>

Hey there–

I’m trying to have a javascript function called when a button in my swf is pressed. But nothing is happening.

I’ve tried both of these, and neither work:

Any help would be appreciated. Javascript is my achilles heel.

T

```auto

import flash.external.ExternalInterface;
button_btn.addEventListener(MouseEvent.CLICK, openDiv);
function openDiv(e:MouseEvent)
{
ExternalInterface.call('$("div.box").show("slow");');
}

```

```auto

import flash.external.ExternalInterface;
button_btn.addEventListener(MouseEvent.CLICK, openDiv);
function openDiv(e:MouseEvent)
{
ExternalInterface.call('javascript:$("div.box").show("slow");');
}

```
