1

I have a compiled swf File (lets call it "cat.swf") that is loaded via the Loader Class of my Main movie. The cat appears without problems. But inside cat.swf there are two movieclips defined (lets call em "head" and "body"), and I have ye to find a way to get control of these from my Main movie.

When I check for numChildren of the loader Object it only gives me back one (an unnamed instance), if I cast that as a Movieclip to check for deeper children it continues all the way down like a tower of turtles.

How can I get access to "head" from my loading Movie?

Sorcy
  • 2,587
  • 5
  • 26
  • 34

1 Answers1

2

Use Loader.content to access the root MovieClip of the loaded SWF. If you specify an interface to the MovieClip's base class, which contains getters for head and body, you can cast myLoader.content to it and access the clips directly in a type-safe way. But if it's just these two, you can of course use bracket syntax, too:

var head : DisplayObject = myLoader.content["head"];

If you have not declared the head and body as fields, you can also use

var head : DisplayObject = DisplayObjectContainer (myLoader.content).getChildByName ("head");

to access the clip via its stage name.

weltraumpirat
  • 22,544
  • 5
  • 40
  • 54