Skip to main content
Known Participant
January 10, 2014
Answered

How do you reference the main timeline of swf1 from swf2 when swf2 is loaded into swf1?

  • January 10, 2014
  • 1 reply
  • 1380 views

on this link          http://kb2.adobe.com/community/publishing/918/cpsid_91887.html

I found this script, but I can not use it can anyone help me

// create a variable to reference swf1's main timeline

var swf1Main_mc:MovieClip;  // this assumes that swf1 is a movieclip.

// create your listener to ensure this loaded swf has been added to the display list and can therefore obtain a

// reference to its main timeline (which is always the main timeline of the loading swf).

this.addEventListener(Event.ADDED_TO_STAGE, initF);

function initF(e:Event):void{

    swf1Main_mc = MovieClip(this.root);

}

This topic has been closed for replies.
Correct answer kglad

please help me with this problem there is a link where you can try it


swf-to-swf communication

http://kb2.adobe.com/community/publishing/918/cpsid_91887.html

1 reply

Ned Murphy
Legend
January 10, 2014

What happens that makes you say you cannot use it?

Known Participant
January 10, 2014

maybe just do not know how to properly used

I tried it like this,

mc1 is in swf2

mc1.addEventListener(MouseEvent.CLICK, clip_bot);

function clip_bot(e:Event):void {

    trace("1 "+swf1Main_mc.P_menu1);

    trace("2 "+MovieClip(this.root).swf1Main_mc.P_menu1);

    trace("3 "+MovieClip(this.root).P_menu1);

    swf1Main_mc.gotoAndStop(2);

    

}


kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
January 12, 2014

please help me with this problem there is a link where you can try it


swf-to-swf communication

http://kb2.adobe.com/community/publishing/918/cpsid_91887.html