Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling/loading functions/sounds of child swf from parent

Status
Not open for further replies.

okiiyama

IS-IT--Management
Jan 3, 2003
269
0
0
US
I am in the process of creating a "Loader" swf which will load (currently) 1 of 3 swf movies which have a video layer and a sound layer.

Generically, How can I access functions and library elements of an swf loaded with: myClipLoader.loadClip(..)?

Mainly, the library element is the "soundtrack" of the movie (Which currently is set to be imported to first frame).


Thanks.
 
You should use _global functions Or an .as file. Your created movie clips can then call the same shared functions.

Hope it helps.

Wow JT that almost looked like you knew what you were doing!
 
Maybe this is the way it has to be done, and I'm fine with that, but I'm not sure I understand the reasoning as to why functions on a child's timeline are not accessible for the child when being called from anywhere outside of the child's timeline.

Example:
child_mc has a funciton on its timeline called speak(t:String). Which executes trace command of the argument. Also, child_mc has been exported for actionscript and on the first frame.
Code:
var temp_mc = _root.attachMovie("child_mc", "child_mc2", _root.getNextHighestDepth());
temp_mc.speak("Im new here");
The above code doesn't work, but what does work is:

Code:
function speak(t:String) {
 trace(t);
}
var temp_mc = _root.attachMovie("child_mc", "child_mc2", _root.getNextHighestDepth());
temp_mc.speak = _root.speak;
temp_mc.speak("Im new here");
The above code works
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top