# Controlling external swf...help needed asap!

**URL:** <https://forum.kirupa.com/t/controlling-external-swf-help-needed-asap/277923>\
**Category:** flash\
**Created:** [December 18, 2008, 9:04pm UTC](https://forum.kirupa.com/t/controlling-external-swf-help-needed-asap/277923 "2008-12-18T21:04:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beyondlearning](https://avatars.discourse-cdn.com/v4/letter/b/45deac/32.png) [@beyondlearning](https://forum.kirupa.com/u/beyondlearning)\
**Post date:** [December 18, 2008, 9:04pm UTC](https://forum.kirupa.com/t/controlling-external-swf-help-needed-asap/277923/1 "2008-12-18T21:04:07Z")

</div>

Hi everyone,

I’m trying to call a function defined in an externally loaded swf from the main swf. I actually got the following code to work:

//code in main.swf

slideshowLoader = new Loader();  
var galleryURL:URLRequest=new URLRequest(“myGallery.swf”);  
slideshowLoader.load(galleryURL);  
slideshowLoader.contentLoaderInfo.addEventListener(Event.INIT,slideshowHandler);

function slideshowHandler(e:Event):void{  
var mySlideshow = MovieClip(slideshowLoader.content);  
addChild(mySlideshow);  
mySlideshow.stopTimer();  
}

//function in external swf (myGallery.swf)

function stopTimer():void {  
trace(“timer stopped”);  
}

In the above example, mySlideshow is added to the stage and works fine. However I actually need to add it to a nested mc in the main.swf. So I tried the following code…without success:

//code in main.swf

slideshowLoader = new Loader();  
var galleryURL:URLRequest=new URLRequest(“myGallery.swf”);  
slideshowLoader.load(galleryURL);  
slideshowLoader.contentLoaderInfo.addEventListener(Event.INIT,slideshowHandler);

function slideshowHandler(e:Event):void{  
var mySlideshow = MovieClip(slideshowLoader.content);  
sceneMC.containerMC.addChild(mySlideshow);  
sceneMC.containerMC.mySlideshow.stopTimer();  
}

//function in external swf (myGallery.swf)

function stopTimer():void {  
trace(“timer stopped”);  
}

In this case, mySlideshow plays perfectly however the stopTimer function causes an error (Error #1010: A term is undefined and has no properties.  
at SMbeta1\_fla::MainTimeline/slideshowHandler()).

Can anyone tell me why this doesn’t work??

Thanks so much!
