Copy link to clipboard
Copied
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.
after loading is complete (and assuming you're loading an as3 swf), you can use:
MovieClip(myLoader1.content).gotoAndStop(1);
Copy link to clipboard
Copied
after loading is complete (and assuming you're loading an as3 swf), you can use:
MovieClip(myLoader1.content).gotoAndStop(1);
Copy link to clipboard
Copied
Perfect. Thank you for your help.
Copy link to clipboard
Copied
you're welcome.
Copy link to clipboard
Copied
I'm just wondering, would it be possible to control a movieclip that is inside the loaded swf? For example, if the loaded swf had three movieclips on the first frame, can you have a button on the main timeline that can set the three movieclips to their frame1?
Copy link to clipboard
Copied
sure.
if the movieclip on the loaded swf's main timeline has reference mc, you would use:
MovieClip(myLoader.content).mc.gotoAndStop(1);
p.s. you might find the following helpful, http://kb2.adobe.com/community/publishing/918/cpsid_91887.html
Copy link to clipboard
Copied
Fantastic. Thanks again.
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now