# Execute function in embedded flex app from swf

**URL:** <https://forum.kirupa.com/t/execute-function-in-embedded-flex-app-from-swf/255676>\
**Category:** flash\
**Created:** [March 25, 2008, 9:48pm UTC](https://forum.kirupa.com/t/execute-function-in-embedded-flex-app-from-swf/255676 "2008-03-25T21:48:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thundercat](https://avatars.discourse-cdn.com/v4/letter/t/dbc845/32.png) [@Thundercat](https://forum.kirupa.com/u/Thundercat)\
**Post date:** [March 25, 2008, 9:48pm UTC](https://forum.kirupa.com/t/execute-function-in-embedded-flex-app-from-swf/255676/1 "2008-03-25T21:48:10Z")

</div>

Hi,  
I have a flex flv player application that I’m loading into a wrapper flash movie. The flv player works great with the exception of one thing… when you go to a different area, any playing movies are not unloaded properly.

The flex application contains a “clearMovies()” function that I need to fire from the parent swf movie.

The main timeline loads a MovieClip with instance name “moviePlayer” on the main timeline… this “moviePlayer” contains the AS3 code to load flvPlayer.swf via loader… (The progress handler is handling a preloader, but I removed that code here)

```auto
var myLoader:Loader = new Loader();
var fileURL:URLRequest = new URLRequest("flvplayer.swf");
var importedPlayer:Object;
myLoader.load(fileURL);
myLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,fileLoaded);
myLoader.contentLoaderInfo.addEventListener(Event.INIT, initHandler);
function initHandler(e:Event):void {
    importedPlayer = myLoader.content;
}
function fileLoaded(event:ProgressEvent):void {
    if (event.bytesLoaded == event.bytesTotal) {
        addChild(myLoader); 
    }
}

```

ok… On the same root timeline is a MovieClip “Navigation” that contains the following function that is executed when any navigation button is clicked…

```auto
function clearmovie():void {
        if(MovieClip(this.root).moviePlayer) {
            MovieClip(this.root).moviePlayer.importedPlayer.unloadMovies();
            MovieClip(this.root).moviePlayer.removeChild(MovieClip(MovieClip(this.root).moviePlayer).myLoader);
        }
}

```

I get “Error #1069: Property unloadMovies not found on \_flvplayer\_mx\_managers\_SystemManager and there is no default value.” whenever the clearmovie() function is fired.

Can someone offer any help? I’m at a loss.

Thank you!  
Kevin
