PDA

View Full Version : loadMovie - loaded movies not playing


ubergrafik
10-19-2005, 12:47 AM
I have added to an earlier post, but thought it would be easier to restate exactly the issue I was having. OK.

I have many swf's that contain preloaders. What I need to do, is create another swf that will load a swf in, and play it. It stops on the first frame. Here is what I have done so far:

In the "loader" swf, I have put the following:

nav_load.onRelease = function() {
loadMovie(load_txt, cont);
};

The "loaded" swf's have a preloader with the following code:

//preloader
stop();
//WAIT FOR LOADING
onEnterFrame = function () {
var movieBytesloaded = _root.getBytesLoaded();
var movieBytesTotal = _root.getBytesTotal();
var moviePercentLoaded = (movieBytesloaded/movieBytesTotal)*100;
if (moviePercentLoaded>=100) {
_root.gotoAndStop("loaded");
delete this.onEnterFrame;
} else {
this.preloader_mc.frame_mc._xscale = moviePercentLoaded;
}
};

So, what happens is this:
- open the loader swf
- press the load button
- the loaded swf loads into place
- it does not play

I want it to play and cannot get it to do it. I suspect I am having pathing issues because I'm using _root. Well, I never thought I'd say it, but I'm having root issues :) The rest of the loaded movie absolutely freaks out because it uses _root too.

I am unable to change any of the "loaded" swf's, so I need to work with the "loader" and get that going.

ubergrafik
10-19-2005, 12:51 AM
OK, looks like I answered my own question. Well, since it is the case that my loaded movies use _root, is there any way I can do something in my loader that will over-ride this? (no pun intended)

oldnewbie
10-19-2005, 01:12 AM
...
if (moviePercentLoaded>=100) {
this.gotoAndStop("loaded");
delete this.onEnterFrame;
} else {
...

But why gotoAndStop ?

ubergrafik
10-19-2005, 01:53 AM
There's an "enter" button on that frame.
I am not able to change to code on the "loaded" swf, so was wondering how to modify the lockRoot from the "loader" swf. All the code in the preloader has to stay the same...

oldnewbie
10-19-2005, 01:57 AM
How do you know what's the preloading code on the loaded .swfs, if you don't have access to the .flas?

ubergrafik
10-19-2005, 02:00 AM
I have access to the template file, but not the source code to the swf's that have been made, there are hundreds of them too...

madgett
10-19-2005, 02:07 AM
On the swf's root being loaded in...this._lockroot = true;

oldnewbie
10-19-2005, 02:10 AM
Madgett... :rolleyes:

I am not able to change to code on the "loaded" swf...

madgett
10-19-2005, 02:14 AM
Yep :p, could try it even on the loader swf.

spy
10-19-2005, 02:16 AM
if u are loading the "loaded" swfs from an external path i mean not in ur pc or ur same domain.. u just cant have access to them, flash blocks them and u will need the an xml with some permissions to load them... or maybe those files are in a newer version of the one u are using...

oldnewbie
10-19-2005, 02:27 AM
Try loading them on another level rather than in a container clip... References to _root shouldn't then be a problem...

ubergrafik
10-19-2005, 03:23 AM
oldnewbie - That didn't work either...

spy - I'm loading the swf's from the same directory on a local machine.

oldnewbie
10-19-2005, 03:34 AM
What didn't work? It didn't play, or if it did play it was still screwed up because of references to _root?

Can you post a link to, or attach one of those external movies, I'd like to try something...

Assuming you we're right saying the preloader is only on the first frame.

ubergrafik
10-19-2005, 03:52 AM
It was the pre-loader that still doesn't work - e.g. it sits on the first frame - presumably still looking for a root.
Yes the pre-loader is on the first frame.
I have attached a version that has all the features of the other ones.

oldnewbie
10-19-2005, 04:20 AM
I don't get it!

This movie seems to have 14 frames total. Once loaded it seems stopped on frame 6, where if I press the enter button, it goes to frame 10 and stops.

You're saying that after the preloader frame, it stops on frame 2?

What are the frame labels on that movie, and on which frame are they?

What's the code on the enter buttons?

ubergrafik
10-19-2005, 04:35 AM
I've removed tha actual content from the rest of the movie. The first scetion is exactly the same as all the other are.
I have put a stop action on the frame 10 - normally it would play out into the content. Sorry for not being clear...
When it is loaded through the loader, it stops on frame 1.

I have attached the loader.

ubergrafik
10-19-2005, 04:37 AM
Code on the enter buttons is:

enter_btn.onRelease = function() {
gotoAndPlay("init");
};

But there is a stop action on frame 10.
Frame 1: preloader
Frame 6: loaded
Frame10: init

ubergrafik
10-19-2005, 04:42 AM
here's source for both files.

oldnewbie
10-19-2005, 04:54 AM
I'll have a look at your files, but why do I still see the loadbar or in fact it's border after frame 1, if I'm then out of the preloader?

oldnewbie
10-19-2005, 04:57 AM
No! I'm on MX only, so...

Unexpected file format! Can't open your .fla.
You'd have a better chance of getting an answer if your .fla was in a MX only format, and zipped up.

You would have to save a copy of your MX2004 .fla, (using Save as...) and changing the Document type to MX only in the Save as... window.

ubergrafik
10-19-2005, 05:07 AM
OK, try this. Thanks for this.

oldnewbie
10-19-2005, 05:23 AM
preLoadTest1.fla is still in a MX2004 format.

oldnewbie
10-19-2005, 05:26 AM
And I'd probably need to see your template.fla also...

ubergrafik
10-19-2005, 05:31 AM
OK, we're there, I hope...

oldnewbie
10-19-2005, 05:49 AM
Well, it somewhat works for me when I load it on a level rather than in your cont container clip... It stops on "Loaded" as expected...

No way it will work if you have references to _root in those loaded movies and keep loading them in your cont container clip... Unless you do edit them .flas, but that seems to be out of the question...

As for your text displays and your next & prev buttons, they'd probably have to be re-coded, considering the movies would now be loaded on a level rather than in a container clip... Would then need to see at least your template .fla, to see how it's coded...

That said, I'm waisted... Going to hit the sack now.

Catch you later tomorrow, if you want to pursue this!

ubergrafik
10-19-2005, 06:39 AM
Ok, thanks for your efforts!

ubergrafik
10-19-2005, 11:58 PM
Can I perhaps load the "loader" into another level, thus leaving level0 free for loading other things? I'm not sure if that would work tho... trying now.

oldnewbie
10-20-2005, 01:06 AM
:confused: :confused: :confused:

ubergrafik
10-20-2005, 01:19 AM
What I am playing with now, is the following.

In my "loader", I have the following on the main timeline:

attachMovie("interface", "interface", 1);

inside interface, I have the following:

nav_load.onRelease = function() {
loadMovie(load_txt, _level0);
};

This replaces everything with the "loaded" swf (which functions correctly).

Pretty sure my theory is right tho...

oldnewbie
10-20-2005, 02:51 AM
Of course it works if you load the movie on level 0, you're replacing your interface & main movie with that movie, that's exactly like running it on it's own...

ubergrafik
10-20-2005, 03:44 AM
So there is no way of loading the intereface into a level that will not be affected by the loaded movie?

oldnewbie
10-20-2005, 04:17 AM
The problem remains in the fact that you have references to _root in the loaded movies, that you say you can't edit.
Thus, IMHO, the only way is to load them movies on another level (in the player) rather than in a container clip of your main interface movie.
When you load an external .swf on another level, references to _root still point to the root level of that movie itself, not to the root level of your main interface movie, thus the coding should still work correctly.

Now, I've managed with a generic preloader within your main interface movie, to actually override your loaded movie's own preloader and thus have it play and not stop on frame 1...

There would still remain positioning issues, since you're loading the movies on another level (and again because you can't alter the code within the loaded movies themselves...), but those could be resolved.

Don't really know if your text displays in your main interface movie must display info from the loaded movies, and if your next & back buttons are also meant to control the loaded movies, but if so, those issues can also be resolved by re-coding your main movie appropriately.

ubergrafik
10-20-2005, 04:30 AM
OK, so the interface that is being loaded into level 1 is the used to load something into level 0. So why dies the interface disappear? Shouldn't it be "safe" because it's in level 1? Or am I totally, totally missing something here?

I thought that when you load a swf into another one, all the _root references from the loaded movie, then refer to the movie that loaded it. Is that not why the preloader stalled? Because it can't reconcile the _root properly?

The loading of movies is no problem, but the retaining of the interface is the issue. That needs to stay. So a generic preloader in the interface is not going to help.

oldnewbie
10-20-2005, 05:21 AM
No! What you're missing is that if you replace whatever movie that's on level0 (or _root) with another movie, you're also clearing all movies that were loaded on other levels, thus your interface on level 1 is also cleared...

Here's what I meant with loading the "load.swf" on another level (level 5) through a generic preloader within your interface movie loaded on level 0.
I've added some new content to your "load.swf" for weight! :cool:

EDIT: Link removed!

ubergrafik
10-20-2005, 11:52 PM
OK, I get it now. Can you post me those files please.

ubergrafik
10-25-2005, 12:06 AM
oldnewbie, I was keen to see what you came up with. Am I able to see what you did please?

oldnewbie
10-25-2005, 01:25 AM
Here you are...

ubergrafik
10-25-2005, 06:03 AM
Can you please explain why you put the unique number in there? I have commented it out and seen no adverse affect. Just wondering what it was all about.
Thanks again.

oldnewbie
10-25-2005, 01:21 PM
Take it out! Unless you never want the browser to use the cached file on a refresh or re-loading, but to always load the file (maybe updated) from the server.
I use that while testing movies, so that my preloader re-appears each time, rather than to have clear the cache each time between tests, since my preloader is coded to not re-appear, once the fie is cached.

ubergrafik
10-25-2005, 11:21 PM
Cool, good idea. Thanks for all your help with this.