PDA

View Full Version : [Flash MX] loaded movie controlling the source movie



meisje
April 28th, 2003, 07:09 PM
hello there,

say i have a main movie, into this movie is loaded another movie on level_1.

is there any actionscript that allows a button inside the loaded movie control the main movie? i.o.w. can a button inside the loaded movie tell the main movie to go to another scene?

+ i am looking for code for that same button to unload the movie it is in itself.. possible?

thanks very much in dvance

meisje

kode
April 28th, 2003, 07:56 PM
is there any actionscript that allows a button inside the loaded movie control the main movie?

_level0.gotoAndPlay("sceneName", frameNumber);

i am looking for code for that same button to unload the movie it is in itself.. possible?

_root.unloadMovie();
?? =)

meisje
April 28th, 2003, 08:10 PM
alas it was no go :(

i typed:

on (release) {
_level0.gotoAndPlay("Scene 2", 1);
_root.unloadMovie();
}

i also tried with _parent in front of the root-path but that didn't work either..

kode
April 28th, 2003, 08:23 PM
instead of the scene name and frame number, try with a frame label. go to Scene 2, highlight the first frame, and you'll see an input field in the properties panel.

the script would change to:

_level0.gotoAndPlay("frameLabel");
as for unloading the swf...
there's nothing wrong with the script, if you can't get it to work... attach your files and i'll check it out. ;)

meisje
April 28th, 2003, 08:59 PM
hey there, i am happy now, after stripping my project to make a lighter upload and testing it.. it suddenly worked, hurray =) many thanks kax!

btw, is it possible to make the mainmovie level_1 right after start-up and load other movies into level_0? would be handier for me lay-out wise

meisje
April 28th, 2003, 09:07 PM
wait wait,

i also found the reason why it didn't work before stripping my project, i think it was because the button in question was from the library of the mainmovie, only when i converted that button to an internal button (of the loaded movie itself) the code worked..

so my question is, do you know a solution for this?

tia, meisje

meisje
April 28th, 2003, 09:46 PM
here are 2 flashfiles with the external button that keeps the movie from unloading, if you could look at it please?

tia, meisje

:toad:

kode
April 29th, 2003, 12:13 AM
ok... first off, sorry about the delay. =)

anyway, i might be wrong, but i guess it didn't worked because once the Button is imported to the movie, the on handler is erased. to solve the problem, give an instance name to the Button and paste this script in the timeline:

instanceName.onRelease = function() {
_level0.gotoAndPlay("start");
_root.unloadMovie();
};
and don't forget to replace instanceName with the actual instance name of the Button. =)

meisje
April 29th, 2003, 01:07 AM
all works now! hurray!

late reply.. you have got to be kidding :)

thanks for the excellent help

these smilees are all for you

<:} C:-) :toad:

later, meisje

kode
April 29th, 2003, 01:12 AM
no problem, meisje. =)

and welcome to kirupa forum!! ;)

meisje
April 29th, 2003, 01:31 AM
hurray! :)