Groups | Blog | Home
all groups > flash actionscript > february 2006 >

flash actionscript : loadMovie event confusion



ekora
2/22/2006 9:47:40 PM
Hi,
I'm trying to use loadMovie to load an external swf. I don't want to use a
button to launch these external swfs, I'd like them to load as I get to a
particular frame. So I've tried using:

onClipEvent (load){
loadMovie("_Frame.swf",1);
}

That seems to work ok evethough this is for a MC event rather than a frame
event, but I'm having two problems.

First, I have a nested external mc (_EkoraFrameName.swf) loaded into
_Frame.swf which is external to my host swf (_Host.swf). Within
_EkoraFrameName, I have a button that is supposed to navigate to the "home"
label on the main timeline of _Host. I'm guessing I goofed the target for this
but here is what I used:

on (release) {
_root.gotoAndStop("home");
}

I was hoping that by using _root, it would default to my host swf file's
_root. Doesn't seem to be, but it could also be blocked by my second problem.

The second problem is that I cannot find a way to have _Frame.swf leave the
stage of _Host.swf. I've used a couple different variations of unloadMovieClip
and none are working. Very quirky.

Here is a zip with all three .fla files. Let me if you see anything.
http://www.ekorastudios.com/swfs.zip - These are the swf files, download these
first and take a look while the .fla files are downloading...
http://www.ekorastudios.com/ekora.zip - give it a minute, it's 26MB

Thanks in advance,
Brian

p.s. to be honest, I'm not 100% sure that I correctly loaded _EkoraFrameName
into _Frame correctly. It works, but I'm not understanding the placement of
things. What has been confusing to me is the differences between using the
loadMovie command in the different event handlers (button, frame, mc). I know
how to launch them with a button, but I need to know the ins and outs of using
loadMovie with MC & frame events.



blemmo
2/22/2006 11:39:01 PM
On a frame, you don't need the onClipEvent, you can just call loadMovie.
I'd recommend loading the swf into another MovieClip, that makes it easier to
get rid of it later.
createEmptyMovieClip("container",1);
container.loadMovie("_Frame.swf",1);

For the button, you can try leaving out the _root (as this would refer to the
root of the level you loaded it into, not the main root). I think if you goto a
labeled frame, Flash finds it without an explicit path. If not, use _level0
instead of _root, as this will always refer to the main timeline.

To unload the movie, you can use
container.removeMovieClip();

greets,
blemmo
AddThis Social Bookmark Button