Skip to main content
April 2, 2008
Question

Is there a way to call a function in a external swf?

  • April 2, 2008
  • 1 reply
  • 341 views
I have two swf's... one that loads another... just like the following code.
Is there a way to call the function "test()" in the "2.swf"?
This topic has been closed for replies.

1 reply

April 2, 2008
if you load sw2 into a movieclip instance (named "container" i.e) that is in sw1, have you tried?
_root.container.nameofyourfunction();
if your function is inside another movieclip in sw2:

_root.container.moviclipofswf2.nameofyourfunction();
April 2, 2008
Sorry, I didn't get it. Could you give me some more info?
Thanks.
April 2, 2008
at any point in 1.swf try the following code:
_root.mc.test();

where "mc" is the clip you have created with createEmptyMovieClip.
As you wrote your function "test" is located in the main timeline of 2.swf, right? :)