0

i'm trying to call a function in UnrealScript through ActionScript using ExternalInterface.call but for some reason it wont work when i test it.

the actionscript:

this.onRollOver = function()
{
gotoAndPlay(50);
ExternalInterface.call("Test");
}

(i'm importing "flash.external.ExternalInterface" on the stage/root/whatever you like to call it)

my UnrealScript function:

  function Test()
  {
    `log("Externally Interfaced");
  }

when i roll over my movieclip the log message never shows up. Am i doing this right?

any help would be greatly appreciated! thanks in advance

user2486771
  • 1
  • 1
  • 4
  • 1
    Did ActionScript 2 even _have_ ExternalInterface? Look at [fsCommand](http://www.moock.org/webdesign/flash/fscommand/) or getURL – Amy Blankenship Jun 16 '13 at 12:55
  • also check `ExternalInterface.available` which will return `true` or `false` depending on if you can call it or not. flash can have a habit of silently swallowing errors in release builds – divillysausages Jun 16 '13 at 13:25
  • @divillysausages thank you for the reply! i've done testing and both in Flash and my UDK game build they both return false, is there any way to rectify it? or do i need to re-create my file in AS3? – user2486771 Jun 17 '13 at 06:05
  • EDIT: Never mind, i've found the problem, i'll add it as an answer now for anyone who has the same problem – user2486771 Jun 17 '13 at 06:22
  • good to see you got it working :) – divillysausages Jun 17 '13 at 10:48

1 Answers1

1

My apologies guys, it was unclear to me on how to use ExternalInterface after doing some testing and playing around with it more i found the solution.

While i imported

flash.external.ExternalInterface; 

on the _root stage, it didnt carry to the frame where i called

ExternalInterface.call

so i just resorted to importing on the necessary frame and it worked perfectly!

user2486771
  • 1
  • 1
  • 4