Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

createEmptyMovieClip issues

Status
Not open for further replies.

jzauner

Technical User
Feb 21, 2006
22
US
I'm trying to set up my navigation so it's easily scalable.

Right now I have the navigation as a movie clip saved as a .swf file and then I use the _root.createEmptyMovieClip() to bring it into a a container on each page. The idea is, if any changes are made to navigation, I won't have to go into each page and update.

It works fine in the first flash movie that opens the site but the same action script fails on every page there after (i've done three).

Here's the script:

onLoad = function () {
_root.createEmptyMovieClip("container", 100);
loadMovie("flash/navigation.swf", "container");
container._x = 0 ;
container._y = 0 ;
}
play();


If I set the "100" to "0" on the first line above I can see the navigation below the currently playing movie.

Also, I'm using this script to bring up next page:

on (release) {
loadMovieNum("/site/flash/bagsOther.swf", 0);
}
 
You are creating different instance names for the "container" clip right? (container1, container2, etc...)
 
If you want to keep the first bit, do the second bit like this:

[tt]//
on (release) {
this.createEmptyMovieClip("main", 0);
loadMovie("/site/flash/bagsOther.swf", main);
}
//[/tt]

Kenneth Kawamoto
 
REF: pixl8r (Programmer)
"29 Mar 06 22:00
You are creating different instance names for the "container" clip right?  (container1, container2, etc...)"

No. I'm a novice at Flash and I think I see what you're getting at, but I'm not realy sure.
 
REF: Well, by now you know what I'm trying to get at!

//
on (release) {
    _parent.createEmptyMovieClip("main", 0);
    loadMovie("/site/flash/bagsOther.swf", _parent.main);
}
//

---

Here's the link:
In the navigation, go to BAGS and at the bottom, click on OTHER. You'll see, when that page (movie) comes up, the navigation is gone despite the fact that (and I think this is your point) the page has the identical creatateMovieClip() script running.

Thanks in advance.
 
I don't know the structure of your movie so I assumed the parent of your button is your root, but it seems not.

Try:

[tt]//
on (release) {
_root.createEmptyMovieClip("main", 0);
loadMovie("/site/flash/bagsOther.swf", _root.main);
}
//[/tt]

Kenneth Kawamoto
 
If this is what you are doing on all of your links
Code:
onLoad = function () {
    _root.createEmptyMovieClip("container", 100);
    loadMovie("flash/navigation.swf", "container");
    container._x = 0 ;
    container._y = 0 ;
}
play();

Then you are having a problem because you are trying to create multiple MC's with the same name on the same timeline. Kenneth is suggestiing that you make it relative to the code (ie: _parent vs. _root) which may or may not work depending on your structure. You either need to use unique names for each clip or you need to dispose of the clip when you are through with it (moviclip.removeClip()).

Hope that helps.

Wow JT that almost looked like you knew what you were doing!
 
It sounds like disposing of the clip (movieclip.remove()) is the best way to go.

Would it look like this:

movieclip.removeClip(); //unloads the movie in the container?

onLoad = function () {
    _root.createEmptyMovieClip("container", 100);
    loadMovie("flash/navigation.swf", "container");
    container._x = 0 ;
    container._y = 0 ;
}
play();

Thanks in advance.
 
Okay, disregard and thanks for your input. It helped me think this through. Turns out I was over thinking the problem.

This bit of script accomplished what I was looking for:

loader_mc.loadMovie("flash/navigation.swf");


Thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top