# Interaction Between Loaded Movies

**URL:** https://forum.kirupa.com/t/interaction-between-loaded-movies/33787
**Category:** flash
**Created:** [October 23, 2003, 5:06pm UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787 "2003-10-23T17:06:20Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![jondj24](https://avatars.discourse-cdn.com/v4/letter/j/5f9b8f/32.png) [@jondj24](https://forum.kirupa.com/u/jondj24)
#### Post date: [October 23, 2003, 5:06pm UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787/1 "2003-10-23T17:06:20Z")

</div>

i have my loaded .swf buttons loading ‘movie1’ and ‘movie2’. both ‘movie1’ and ‘movie2’ have a tween in frames 1-5, which is a box that slides open and is stopped. in frames 6-10 the box slides backwards in the opposite and dissapears.

i would like it if ‘movie1’ is open and the user clicks the button for ‘movie2’, ‘movie1’ plays 6-10 and then loades ‘movie2’ and vice versa. i just don’t a script for this function…can someone help me? i attached the files to this post.

thanks.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 23, 2003, 5:39pm UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787/2 "2003-10-23T17:39:18Z")

</div>

I haven’t looked at your file, but I just wanted to give you some advice: you can always store values in \_root, which will make that value accesible to both the loaded and the main file. That way, you can interact with your loaded movies. You can also target the main timeline of your loaded movie from the main movie by targetting the movieclip it was loaded in 🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 23, 2003, 7:55pm UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787/3 "2003-10-23T19:55:12Z")

</div>

would the script look something like this:

```auto

on (release) {
        if (_root.movie2.line_mc._currentframe == 5) {
                tellTarget (_root.movie2.line2_mc.) {
                        gotoAndPlay(6);
                }
        } else {
                loadMovieNum("movie1.swf", 1);
        }

```

this script applies if ‘movie2’ is open and the user clicks the button for ‘movie1’, ‘movie2’ plays 6-10 and then loades ‘movie1’ and vice versa if the other button is chosen.

i tried this and it didn’t work for me…any suggestions?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 23, 2003, 8:11pm UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787/4 "2003-10-23T20:11:06Z")

</div>

You can try this:

```auto

_root.curmovie = "movie1";
_root.movieholder.loadMovie("movie1.swf");
movie2button.onRelease = function(){
if(_root.curmovie != "movie2" && _root.movieholder.line_mc._currentframe == 5){
_root.movieholder.gotoAndPlay(6);
}
}

```

And then, at the last frame of movie1, you place these actions:

```auto

_root.movieholder.loadMovie(_root.curmovie+".swf");

```

🙂

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 23, 2003, 8:19pm UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787/5 "2003-10-23T20:19:45Z")

</div>

i am going to try it now! what exactly is curmovie?  
i’ve never heard of it…but i haven’t heard of a lot of things in Flash ( i’m sure )

thanks.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 23, 2003, 11:10pm UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787/6 "2003-10-23T23:10:39Z")

</div>

i tried everything you did and said, but now, the buttons don’t load the movies at all.

i attached the revised version. could it be something else?

thanks.  
jonathan

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 24, 2003, 5:31pm UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787/7 "2003-10-24T17:31:47Z")

</div>

curmovie is just a variable I’m placing in \_root. It doesn’t load because you don’t have a movieclip to load it to. You’re not supposed to just copy/paste code from here and hope it’ll work, you need to look what happens and change your movie structure for the actionscript to work 🙂

Also, there is no outro animation, just two frames. You said there were 10 in them ? You’re checking if \_currentframe is 5, but there are only 2 frames !

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 25, 2003, 12:35am UTC](https://forum.kirupa.com/t/interaction-between-loaded-movies/33787/8 "2003-10-25T00:35:55Z")

</div>

i never just copied and pasted the script into my project without adjusting things, but in the 2nd frame of movie1 and movie2 lies a movieclip that is 10frames long. again, thanks for your help. it is truly appreciated. unfortunately i am away from my computer, so i won’t be able to look at what you have done until monday.

thanks.
