views:

147

answers:

1

How to control imported .swf timeline?

   var introLoader:Loader = new Loader();
    var introReq:URLRequest = new URLRequest("intro.swf");
    introLoader.load(introReq);

    introLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);

function onComplete(e:Event){
    addChild(introLoader);
 }
+1  A: 

Use loader.content to access the loaded content.

//store it in an instance variable for conveniently 
//accessing it from outside.
public var loadedmc:MovieClip;
function onComplete(e:Event)
{
  addChild(introLoader);
  if(introLoader.content is MovieClip)
    loadedmc = introLoader.content as MovieClip;
  else
  {
    trace("its not even a movie clip - no timeline for you");
    return;
  }
  loadedmc.gotoAndPlay(4);
}

//Once loaded (once Event.COMPLETE is fired),
//you can always access it using:
MovieClip(introLoader.content).gotoAndStop(3);
Amarghosh
How would you call root method from a child?
dd
@dd `RootType(root).somemethod()` should work in normal cases - if it doesn't ask a new question and provide some more details.
Amarghosh
I figured it out MovieClip(parent.parent).method(); (wut?!!). ty
dd
@dd if child is nested further down the list, you're gonna need more parent.parent's - That's why there is a `root` variable.
Amarghosh