How can i manipulate movies i load with loadmovie()

Can anyone help me on this topic. I load 2 movies at the same time using loadmovie() function onto 2 different locations on the flash page. i would like to know if i can have a button in the second movie that can control, lets say play, the first movie when this button is released.

Please let me know if anyone can help me with this. thank you very much.

I just answered a similar question :slight_smile:

let’s say your movie containers (the movieclips you load the movies into) are named c1 and c2.

then, in your c1 movie, just use a button with these actions:

button.onRelease = function () {
this._parent.c2.play();
};

and in your c2 movie

button.onRelease = function () {
this._parent.c1.play();
};

this ofcourse needs the c1 and c2 movieclips to be in the same movieclip (or in the _root). if they are nested within other movieclips, you’d have to “work your way through the levels”

thanks for replying, but i still can’t get it to work. Let’s say that the main swf is called loader.swf. In this file i am loading 1) menu.swf and 2) animation.swf

On the stage of loader.swf i have an empty movie clip instace called “menu” which the menu.swf is loaded onto and another movie clip with instance called “animation” where animation.swf is loaded onto.

Now when the animation file loads it plays until frame 20 and it stops. The menu file has a button in it where when i press it i want the “animation.swf” to continue playing from frame 20 untill the next stop. i tried to do what you said but it doesn’t work and i get the follwing error message:

[color=blue]Error Scene=Scene 1, layer=Layer 6, frame=1:Line 1: Statement must appear within on handler[/color]
[color=blue]button.onRelease = function () {[/color]
[color=blue] [/color]
[color=blue]Total ActionScript Errors: 1 Reported Errors: 1[/color]
[color=#0000ff][/color]
[color=black]Please help me with this cause its driving me insane. thank you for your time.[/color]

if you want to place the code ON the button you have to change it a little bit:

on (release) {
this._parent.animation.play();
}

on (release) {
this._parent.menu.play();
}

hey man thanks for the help.

No probs :wink:

i am stuck again. What i need to do now is this. My Menu has 3 items in it. and there are 3 different animations i need to load depanding of the menu item clicked. But when an item on the menu is clicked i need it to play the current animation to completion and then load the new animation that corresponds to the button i just pressed. I hope you understand what i am talking about here.

i hope you can help me here. Thanks again for your help

yes I know what you mean, and this has been answered before. hmm.

this is similar:
http://www.kirupaforum.com/forums/showthread.php?t=34166

I can describe it shortly, but I really need to sleep :stuck_out_tongue:

on the -last frame- of your animation that you want to play before the movie loads, write this:

this._parent.loadMovie(_root.movieToLoad);
or _root.loadMovie(_root.movieToLoad); or something like that

then on every button write something like this:

on (release) {
_root.movieToLoad = “movie1.swf”;
yourAnimation.play();
}

and so on.
this will make the button to set the movieToLoad variable to the appropriate value, and when the animation reaches the last frame, it will load the movie that the movieToLoad refers to.

good night and sorry for the bad explanation!

no man thanks alot…i realy apreciate the help. good night and have a good sleep

I hope you’ll get it working. If not, just post another message here and I’ll get back to ya tomorrow evening or someone else will help ya :slight_smile:

man you are super nice…thanks alot for helping me. I finaly got it working.

I need some help. I have a movie lets say test.swf loaded onto a movie clip called"test". i have a button in another movie clip that is suppose to load the test.swf movie. I want it to only load if the movie in “test” is NOT the test.swf file. i want to have an IF function to check whether the movie clip in the “test” instance is the test.swf and if NOT to load that file. can anyone tell me how to do that please.

thank you.

on (release) {
if (_root.currentMovie != “test.swf”) {
this._parent.something.loadMovie(“test.swf”);
_root.currentMovie = “test.swf”;
}
}

and on other buttons (that load other movies)

on (release) {
_root.currentMovie = “otherMovie”;
// and blaha blaha loadMovie blaha
}

hey man what do you do? are you a proffesional programmer or something? You are very helpfull, that is a rarething these days. thanks again!

its not working.

[color=blue]on (release) {[/color]
[color=blue] [/color]
[color=blue]if (_root.graphic != “main_gra.swf”) {[/color]
[color=blue] [/color]
[color=blue] _root.currentMovie = “test.swf”;[/color]
[color=blue] _root.movieToLoad = “main_gra.swf”;[/color]
[color=blue] _root.movieToLoad1 = “main_text.swf”;[/color]
[color=blue] _root.graphic.play();[/color]
[color=blue] [/color]
[color=blue]}[/color]
[color=#0000ff][/color]
[color=black]This is what i have. This code is on the button that is suppose to load the “main_gra.swf” file. I want it to load if and only if it is not already loaded. But if its not loaded i need for it to play the current movie to completion, like u showed me how yesturday, and then load this new “main_gra.swf” file. [/color]

movieToLoad1 is a movie clip containing the text giong underneath the main grapgic.

the “main_gra.swf” is loaded onto instance ‘graphic’
the "main_text.swf’ is loaded onto the instance ‘main_text’

so when the button here with this code, lets sa ‘HOME’ is pressed i need for it to check if both files are loaded already or not and then execute to load them, only if they not already there.

i hope you understand. and thanks again.

ps. i have this code at the end of all other clips like u said:

[color=blue]_root.graphic.loadMovie(_root.movieToLoad);
_root.main_text.loadMovie(_root.movieToLoad1);[/color]

thanks :slight_smile:
beside my studies, I work as web developer/designer yeah. Rare thing? here at kirupaforum? naaaahh :wink:

try this:

if (_root.movieToLoad != “main_gra.swf”) {
_root.movieToLoad = “main_gra.swf”;
_root.movieToLoad1 = “main_text.swf”;
_root.graphic.play();
}

It works now dude…thanks

no problem

here it is, i got this from another thread.

_root.createEmptyMovieClip(“container”, 1);
loadMovie(“loaded.swf”, “container”);
container._x = 150 ;
container._y = 20 ;

how does this work?

c_mc = _root.createEmptyMovieClip(“container”, 1);
c_mc.loadMovie(“loaded.swf”);
c_mc._x = 150;
c_mc._y = 20;