Skip to main content
Participant
June 19, 2013
Answered

Controlling loaded swf from main timeline

  • June 19, 2013
  • 1 reply
  • 1064 views

Hello,

I'm working on loading external swf files for ios. I am able to load the swf files and set them to visible or invisible in different frames. I am having trouble controlling the loaded swf files from the main timeline. Specifically, I would like to have a button on the main timeline, that when clicked will move a loaded swf to frame 1.

Here is a code that loads one swf file:

var myLoader1:Loader;

var loaderContext1:LoaderContext = new LoaderContext(false, ApplicationDomain.currentDomain, null);

if(myLoader1 == null)

{

          myLoader1 = new Loader();

          addChild(myLoader1);

}

myLoader1.load(new URLRequest("folder/file1.swf"),loaderContext1);

myLoader1.visible = true;

backbutton.addEventListener(MouseEvent.MOUSE_DOWN, backbutton1);

function backbutton1(myEvent:MouseEvent):void {???????????? myLoader1.gotoAndStop(1);}  (this line does not work)

(Once I load file1.swf, within the file1.swf I click a forward button to move to different frames. My question is: how do I code the 'backbutton' on the main timeline so that it causes the loaded file1.swf to go to frame 1?)

Thank you for your help.

This topic has been closed for replies.
Correct answer kglad

after loading is complete (and assuming you're loading an as3 swf), you can use:

MovieClip(myLoader1.content).gotoAndStop(1);

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
June 19, 2013

after loading is complete (and assuming you're loading an as3 swf), you can use:

MovieClip(myLoader1.content).gotoAndStop(1);

shaz99Author
Participant
June 19, 2013

Perfect. Thank you for your help.

kglad
Community Expert
Community Expert
June 19, 2013

you're welcome.