-
Hi, guys...
I'm having trouble with loading swf's onto other swf's... I have a main.swf which loads the content onto it (by loadMovie into target), meaning, home.swf, contact.swf, news.swf... When it loads the news page, this news.swf loads another swf onto a target, meaning the pictures according to the article currently being read. If I test the news.swf separately it loads the pictures.swf ok, but when I'm testing the whole thing, the pictures.swf won't load.
Is it not possible to load a movie into another and then another on top????
Thanks
Nicky
-
i think the key to your problem lies in the fact that the news.swf worked alone, but not in the overall movie. i'm willing to bet that within news.swf you have something referring to _root (or / if you are using Flash 4 notation).
when you run news.swf on its own, it will be _root, but when it is within another movie, it is one level up from _root.
-
Hi,
Not really, the code is:
loadMovie ("imagens/_" add noticias_ultima_foto add ".swf", "fotos");
-
geez, I got cut off.
So, noticias_ultima_foto is the variable that tells it which swf to load, since it varies according to the article you are reading...
-
i can't really tell what's going on from one line of code...
but in answer to your question:
Is it not possible to load a movie into another and then another on top????
again, i'm not sure exactly what you are saying. but if you loadMovie, it will replace whatever is currently in that movie. whatever was there originally will be gone. I'm not sure if that's what you are running into...
-
nono, hm,, how to explain... let's try it like this:
The HTML file has the main.swf in it.
The main.swf does a loadmovie into target, and loads the news.swf.
The news.swf does a loadmovie into target (into a mc, inside the actual news movie), and loads the picture.swf.
If these were actual levels rather than targets, the main.swf would be in level 0, news.swf in level 1 and picture.swf in level 2.
Better that way???
-
i think i get the picture.
again, if news.swf works by itself, but not within main.swf, i suspect a path problem somewhere. there should not be a problem with loading a swf into a target within a loaded swf.
-
*sigh*
what to do then? wanna see the originals? Cause the line of code I wrote down, is really the only thing that calls the pictures.swf.
nicky
-
ok, send the fla to [email protected]
-
your problem might be similar to mine. If you invoke _root or "/" this will reference the level0 movie and not the level1 it is likely to be.
Ken
-
Hi...
KP, I sent it, and Ken, I'm not using root. or / anywhere...
I posted the only line of code that does the loading...
thanks anyway...
Nicky
-
Hi...seems like it would have to be...
loadMovie ("imagens/_" add noticias_ultima_foto add ".swf", "targetMC.fotos");
...with "targetMC" being the instance name of the movieClip that you loaded "news.swf" into...
Hope this helps...
-pigghost-
-
Hi, well didn't work. I got all excited with your suggestion, since normally problems are solved with little things like that, but... not this time.
Thanks, if anything else comes to mind, please let me know.
I also tried "_root.content.fotos" ("content" being the name of the movie clip I loaded news.swf into). Didn't work either.
Thanks
Nicky
-
Hi again...(kp has probably already figured this out...:), but anyway...)
I set up a scenario like you described and it worked using the code you originally had...sooooo, a couple of questions...
Are you testing this offline in Flash Player or is this strictly online that it's not working...?
If you're in Flash, are you getting an ERROR from Flash?
If all else fails...send it to me, I'll take a look if you want...maybe I'll see something...
[email protected]
-pg-
-
i looked over your files and i think i located the problem. i don't have all the files needed, so i can't test it, but...
in the first frame of _notacias.swf you load in some variables to level 0:
loadVariablesNum ("noticias.txt", 0);
and in frame 2, you are checking the values of some variables:
if (noticia_selecionada == "penultima") {
...
i assume that that variable - noticia_selecionada - is set in from the loadVariableNum, right?
but it will not be available from within this movieclip!
it will be available from the main time line. when you test notacias.swf by itself, it IS the main timeline, so it works, see? my suspicions were correct.
you need to change it so you are accessing _root variables:
if (_root.noticia_selecionada == "penultima") {
good luck!
kp
-
oh, I'll also give you a big tip, which will save you from going crazy later when you put this on line!
when you loadVariables, you are pulling a file off a hard drive somewhere. when you go on line with this, someone might be loading those variables from half way around the world. the point is they may not fully arrive in 1/12 or 1/20 of a second. so you load variables on frame 1 and check them on frame 2, they may not be there yet! i personally pulled out a lot of hair til i realized this!
the trick is:
in your text file with your variables, add one last variable, something like:
end=1
then load your variables on frame 1.
on frame 3, say:
if(!end){
gotoAndPlay(2);
}
this will continuously play frames 2 and 3 until end == 1
at which point you know all your variables are safely in place.
-
Haha, not just that variable (cause it has an else, in case that variable does not exist) but the line where I load it, needed the "_root." added to the variable.
loadMovie ("imagens/_" add _root.noticias_penultima_foto add ".swf", "_root.content.fotos");
Thanks you all soooooooo very much. And the thing with the loop, it exists already in the loading of the index.swf, so technically the variables should be loaded waaay before I get to noticias.swf.
Thanks, you saved me!!!!
Nicky
-
Piggy (if I may)
just so you don't call me rude, cause I didn't answer your questions... :)
No, I didn't get an ERROR from flash. When I was testing it from inside flash it would work normally, but when i published it it would not work any more.
So, I didn't have an extra "_root." somewhere, I was lacking a "_root."!!!
Again, thanks you guys...
Nicky
-
Piggy!?!....lol
I knew KP would figure it out...glad you got it working...
Take care...
-pg-
-
Hi all this is in the same vein as the above problem but I haven't gotten around mine yet,
I'm using loadmovie to load an external SWF but depending on the method the same movie will behave differently.
example:
action in frame one of the main timeline
loadMovie ("PBNV.swf", 1);
loadMovie ("PBNV.swf", _root.PBNV)
The first movie in the list behaves properly but is not positioned where I would like it on the main movie.
The second movie in the list is positioned properly by replacing the place holder _root.PBNV but now its tell target commands fail.
An online example of this is here:
http://www.kenpurcell.com/flash/NitrogenBottle.html
The correctly operating valve in top left and dead valve in place.
Any help or enlightenment would be greatly appreciated.
Regards,
Ken Purcell
-
Hi Ken,
It really is along that line. Do you have any "_root." in your tell targets? I had to change my paths too, when I wanted to use tell targets inside loaded swf's.
I'm having trouble seeing the addy you posted, can you show us the code? I'm sure my expert friends here will be able to help you out, or maybe they taught me well enough so I can help you!
:)
Nicky
-
Hey, just browsing through this message, and I would like to share similar kind of problem that I had with my guest book which loads variables from an .asp file.
It also worked fine by its self, but whenever I tried to load it into my main movie as an external file, the variable would loop until I was blue in the face! :) In the end, what fixed it was loading the external into a level instead of a targeted mc. Nearest I can tell Flash has some problems with variables on an external file when they are loaded into a target. Bottom line is that when a movie is loaded into a level, it's time line becomes the main timeline. I prefer targets (better placement control), but in the end what works is what I will use. I hope this helps someone out there.
-
i don't think that flash has a problem loading into a target, it just gets a bit confusing to work with. you have to keep the path straight and go through the target mc to get at the variable.
-
wondering if you gusy could help me? it's sort of similar.
here's my situation,
i have a main movie on _level0
i have a background movie on _level1
i have a menu movie on _level2
so far so good.
now i am trying to load the 11 menu options one by one into MCs before moving onto the rest of the movie.
in _level 2, i have this on 11 keyframes:
stop()
loadMovie ("name.swf","_level2.nameclip")
etc.
as i load each MC, i have a frame at the beginning of each MC:
if (this.getBytesLoaded() == this.getBytesTotal())
gotoAndStop(6)
_level2.play()
else
gotoAndPlay(1)
when i run off my hard drive it works. but i when i run it from my host it doesn't.
have any ideas?
thanks in advance.
samir
http://www.amiandsamir.com/main.html
-
I not sure, but I notice 2 things that I would change. First you are loading your movies onto levels not targets so I think this statement:
loadMovie ("name.swf","_level2.nameclip")
Should look like this:
loadMovieNum ("name.swf","_level2.nameclip");
Second, If you are using the
if (this.getBytesLoaded() == this.getBytesTotal())
in an external .swf file, you should not put it on Frame 1. It belongs on Frame 3. So frame 3 of your mc would look like this:
if (this.getBytesLoaded() >= this.getBytesTotal()) {
gotoAndStop (6);
_level2.play();
} else {
gotoAndPlay (2);
}
Also, instead of using frame numbers I would use frame labels. If you move things around in your movie, and you point to a frame number, you have to go back and change all your scripts to call that new number. So, I would label frame 6 playMovie and frame 2 preloadLoop and call on them.
I am not sure that this is really working on your local drive. Have you tested the proloader by hitting CTRL | ENTER, waited for the movie to load, and then hit CTRL | ENTER again? This will show your preloader in action on your local machine.
Let me know if this works