Skip to main content
Inspiring
October 16, 2007
Answered

running a function in a parent at the end of a child.swf

  • October 16, 2007
  • 2 replies
  • 325 views
question: How do I call a function that is inside a parent.swf from a child external swf (class Loader)?


In my menu.swf, there is a child (Loader class) of a content.swf that gets loaded below it on run. Then when a button is clicked, it makes a string that contains the name of the content file to load next, then initiates an ending function on the child, which does some outro animation.

function buttonClick(event:MouseEvent):void
{
nextContent = event.target.name + ".swf";
MovieClip(newContent.contentLoaderInfo.content).endSequence();
}

------------------------------------------

after the ending sequence has executed in the ccontent.swf I need to know how to make a call to a function back in the menu.swf so that I can load the nextContent
This topic has been closed for replies.
Correct answer
Does MovieClip(parent.parent) work, then?

2 replies

Correct answer
October 16, 2007
Does MovieClip(parent.parent) work, then?
ZakNinjaAuthor
Inspiring
October 16, 2007
quote:

Originally posted by: abeall
Does MovieClip(parent.parent) work, then?


hahahaha actually it does. Thank you

here's the 4 functions in order of execution. I don't claim any sort of efficiency or logic.




October 16, 2007
Where is the function, on the timeline? You could try:
MovieClip(parent).functionName()
ZakNinjaAuthor
Inspiring
October 16, 2007
quote:

Originally posted by: abeall
Where is the function, on the timeline? You could try:
MovieClip(parent).functionName()

Thank you for the help.

It compiles but I get a runtime error: TypeError: Error #1034: Type Coercion failed: cannot convert flash.display::Loader@248b5791 to flash.display.MovieClip.