We help IT Professionals succeed at work.
Get Started

How do you manipulate the timeline of a child swf from another child swf?

GodsHand
GodsHand asked
on
551 Views
Last Modified: 2013-11-11
I have three files:

main.fla
collapsed.fla
expanded.fla

Yes, this is for an expandable ad. Basically, it starts expanded. So in expanded.fla, when a certain frame is reached, it collapses and an action is called to tell collapsed.fla to gotoAndPlay("collapsed"). Something like that. Both collapsed.swf and expanded.swf are loaded into main.swf.

I have attached the code so far. Basically I'm trying to get expanded.swf to tell main.swf to play the label "collapsed" in collapsed.swf. What am I doing wrong here? I must be traversing incorrectly or something. I know in AS2 it would work as _root.collapsed_mc.gotoAndPlay("label"), but I can't figure it out in AS3.

Any help would be greatly appreciated!
==================
main.fla
==================

import com.doubleclick.studio.Enabler;
import com.doubleclick.studio.events.StudioEvent;
import com.doubleclick.studio.display.StudioLoader;
import flash.net.URLRequest;

Enabler.init(stage);

ExpandingComponent.startExpanded();
 
var collapsedLoader:Loader = new Loader();
var collapsedRequest:URLRequest = new URLRequest("collapsed.swf");
collapsedLoader.load(collapsedRequest);
collapsed.addChild(collapsedLoader);

collapsedLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(event:Event):void
{
	var collapsed_timeline:MovieClip = collapsedLoader.content as MovieClip;
});

function test()
{
	collapsed_timeline.gotoAndPlay("collapsed");
}

================================
expanded.fla (on a later frame)
================================

ExpandingComponent.collapse();
MovieClip(root).collapsed_timeline.gotoAndPlay("collapsed");

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 7 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE