# ExternalInterface Call

**URL:** <https://forum.kirupa.com/t/externalinterface-call/288848>\
**Category:** flash\
**Created:** [May 21, 2009, 7:23pm UTC](https://forum.kirupa.com/t/externalinterface-call/288848 "2009-05-21T19:23:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pherank](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pherank](https://forum.kirupa.com/u/Pherank)\
**Post date:** [May 21, 2009, 7:23pm UTC](https://forum.kirupa.com/t/externalinterface-call/288848/1 "2009-05-21T19:23:04Z")

</div>

I need to upgrade some AS 2.0 code and could use some help.

In my HTML pages I have a short JS script that looks like this:

```auto

<script language="JavaScript" type="text/javascript">
function startImage(name) { 
    return 3; 
}
</script>

```

And within the old AS 2 code:

```auto

            // TEXTFIELD FOR TESTING PURPOSES
            var testVarTxt:TextField = new TextField();
            addChild(testVarTxt);

            var getString:String;
            // Communicate with the Javascript function "startImage"
            getString = String(ExternalInterface.call("startImage", name));
            // Change the string value to a number
            var JStoFlash:Number = parseInt(getString);
            testVarTxt.text = JStoFlash;

```

Does someone know how to rewrite this for AS 3? I need to use something like parseInt to convert the string to an integer, and, I’m not sure if I’m using the ExternalInterface call() in the correct manner for AS 3.0.
