-
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