-
Some Guy
loaded Movies and preloaders
Hey everyone, I'm having some trouble with loaded movies...I'm using them to build my layout, so the nav is one swf, the content area is another, and the top and bottom areas are separate swfs. Each swf has its own simple preloader.
If I embed one of those swfs into an HTML page by itself and open it in a browser, the preloader works.
But, if I embed the final 'base' swf that loads each of those layout pieces, their preloaders don't do anything...the movies just play when the browser's ugly blue progress bar at the bottom is done.
What am I missing?
Thanks so much!
-
Some Guy
sorry...figured it out
I was copying and pasting that preloader so freely that I neglected to notice expressions like "_root.getBytesloaded" in each loaded swf.
It should really be "_root.targetMC.getBytesLoaded", where 'targetMC' is the instance name of the target movie clip.
So where previously the following may have been appropriate: , I now feel more like this:
-
Hi KGKraeer,
It sounds like you are doing a lot of loading of external .swfs.
A little advice ...
When you create your preloader script. Use.
if(_root.targetMc.getBytesLoaded()>=
_root.targetMc.getBytesTotal &&
_root.targetMc.getBytesLoaded() > 0);
Otherwise your preloader can fail due to the fact that a
connection lag can result in
_root.targetMc.getBytesLoaded() = -1.
If you are using a pre-loader bar consider turning it into
a .swf file and loading it into a level above all others.
Then you could just call it from your preloader script without
changing any script.
ie.If your preloader bar was loaded into a MC instance called
loaderBar on _level4.
if(getBytesLoaded()>=getBytesTotal() && getBytesLoaded()>0)
{ //do something
//turn off your loaderBar
_level4.loaderBar._visible=false;
}
//scale your pre loaderBar
_level4.loaderBar._xscale = (getBytesLoaded()/getBytesTotal())*100;
-
Some Guy
nice
Thanks milosav, good idea...I had already started changing each external swf's preloader to fix the problem, but making one above all others would work even better.
Is there a way, using that idea, that I could create a preloader for the whole opening page, before anything even shows up? Right now the page builds itself as each swf loads; there are four little bars filling at different speeds in different areas of the layout...I like it, but it would be even cooler to create one preloader that appears and loads all 4 initial loaded movies first, before the page animates together.
Then, the only other time the user would see a preloader again is when they clicked into a sub-section.
Is that possible?
-
question on preloaders
I am trying to figure out preloaders and I am not sure where I should go to learn more about it. Can anyone send me a small sample preloader .swf file and PLEASE tell me where to put it? Does it go in the same .swf file as my main movie???
Any help would be great!! thanks so much!
-
Some Guy
hey nklein
Hey...if you go up to "Movies" and do a search for 'preloader', you should find a variety of downloadable FLAs that you can modify to suit your needs (that's how I got started with them).
Some are tougher to figure out than others, but you should be able to implement any one of them relatively easily.
Once you start trying to get them working the way you'd like, and you develop some more specific questions, I think we can be of more help...
Good luck!
-
preloaders
thanks!! I'll search that.
One thing.. is the preloader movie just stored on a different layer in the same main movie??
this is the one thing I am unsure of.. thanks!
-
Some Guy
the way I have it set up is, the preloader elements are all in one scene by themselves at the start of the FLA. This scene is called "preloader" or something similar, and then the scene with the actual content you want loaded comes after and is called something like "main".
There should be code in place in whichever preloader you decide to use that will keep the "preloader" scene looping with the bar scaling until the scene "main" is loaded, then it will go to "main".
Hope this helps...
-
preloader
That does help! Thanks...
-
Hi KGKraeer,
First i would be carefull using scenes. They can be buggy
and as your Movie becomes more complex they can become hard
to handle. When you publish your final .swf all Scenes are
reduced to one Scene on one timeline. If Scene 1 has 100 Frames
then Scene 2 would start on Frame 101 ...but you have no control
over this process. Even Team Macromedia members strongly
advise against using Scenes. (why they keep them is beyond me,
they and so many other Flash users avoid them!!!).
As far as having a preloader that loads multiple .swf files
yes you can do this. But there are some things you need to
keep in mind.
1. Flash will open as many simultaneous connections as it can.
However most browsers have a limit of four. Mac on Netscape
apparently has a user set max of 7. This means that:
loadMovie("movie1.swf","mc1");
loadMovie("movie2.swf","mc2");
loadMovie("movie3.swf","mc3");
loadMovie("movie4.swf","mc4");
loaderInterval=setInterval(loadChecker,100);
function loadChecker(){
dataLoaded=mc1.getBytesLoaded()+mc2.getBytesLoaded ()+
mc3.getBytesLoaded()+mc4.getBytesLoaded();
dataTotal=mc1.getBytesTotal()+mc2.getBytesTotal()+
mc3.getBytesTotal()+mc4.getBytesTotal();
if(dataLoaded>=dataTotal && dataLoaded > 0)
{ mc1.gotoAndPlay(2);
mc2.gotoAndPlay(2);
mc3.gotoAndPlay(2);
mc4.gotoAndPlay(2);
clearInterval(loaderInterval);
}
//scale your loaderBar (if you placed your loader bar on _leve4)
_level4.loaderBar._xscale=(dataLoaded/dataTotal)*100;
}
/////////////////////end////////////////////////////////
In the above example due to the fact that the .swf's being
loaded will be added to the data pipeline when both the
browser and the bandwidth allows. The dataLoaded and dataTotal
figures will change as .swfs are pushed into the pipeline.
So it may not be until say movie3.swf is 70% loaded that you
get the FULL dataTotal. All this means is that your progress
bar actually shrinks back when another .swf is pushed into
the pipeline. You can get around this by adding up the bytes
in all the .swfs you are loading and hard coding that as your
dataTotal variable. But you will want to test this to makes
sure it is an accurate figure. This also means that if you
update your .swf's and their file size changes you will have to
go back and alter your preloader code (that would not be much hassle
as it would all be in one place anyway).
Basicly if your preloader bar was loaded into _level4 the
above Example is a working mutiple .swf preloader. Using
the Flash MX setInterval();
Any questions ... post back.
Milosav
-
milosav
Hey, I was just reading this post and you said .
Even Team Macromedia members strongly advise against using Scenes.
I didn't really understand what you said after that so i was wondering if you could explain that. Also, what would the advantages of using lots of sfw's like KGKraeer is doing?
thanks a bunch
-
Hi justplainsoccer,
There are a lot of advantages to using mutiple .swf files.
1. If you build a flash site that is one Huge movie
your download time could make users bail out because
of the long wait. With your Movie/site made up of smaller
.swfs you can give the user a large amount of content
but loaded as needed.
2. Lets say you have a Movie that when you press a button
it downloads a current news article. If this article was
just in a Scene or part of your main timeline you would
have to mess with your main Movie all the time to update
it when the news changed. If it was in a seperate .swf
then you could just alter that .swf and when the button
was pressed it loaded the current news article.
3. It is the only way to go if you are working in a team
So one person could work on the current news article.
When they were done the just upload it and it is available.
Another member could be working on another "module" etc. etc.
4. It is far easier to find bugs if your site is built in
seperate .swf "modules". One module could be your navigation
and if you have problems with it you can tweak that one
module/swf.
5. You can manipulate the properties of loaded .swf files
like. So if you had a .swf loaded into a movie clip
instance called mcHolder.
mcHolder._visible=false; //it's no longer visible.
mcHolder._x=200; //position it to x 200.
mcHolder._xscale=50; //scale it in x to 50%
etc. etc. etc.
You would have a hard time doing this if you had 20 buttons
in a Scene and wanted to change them all... in a Movie Clip mcHolder._alpha=50; would reduce the alpha of all 20 buttons to 50% with one call. And mcHolder.enabled=false would make all those
button disabled for button events.
As for the rest of what I had to say .... it's about loading
mutiple .swf file all at once rather than one at a time. And
some of the things to keep in mind concerning browser/bandwidth
limitations.
Milosav
-
Some Guy
dude, that is awesome
Thanks very much milosav for that comprehensive reply, lots of great stuff in there. I'm gonna rework the way my site is being preloaded entirely...
Hi justplainsoccer, it's become apparent to me during the course of this post that milosav can probably give you a more qualified answer, but the reason I'm using loaded SWFs is because I didn't want the user to have to wait for a huge website to download (I have a bunch of content), so they download a piece at a time...clicking a button for the 'web design' section from the nav causes only part of the Flash layout to be replaced by a new externally loaded swf, containing only the web design section. This makes changes and updates a little easier too, since you're dealing only with one swf per section instead of wading through a giant FLA and using Movie Explorer to figure out what's going on when you come back to it months later.
Good luck, and thanks again milosav!
-
Thanks for all the help guys! Thats awesome! Thats why i love this place. Just one more question... Dont laugh. Do you have the swf's on
one timeline or do you use the getURL and have them named differently on your website? thanks in advance
-
Some Guy
you bring the SWFs in using levels or movie clips
What I did was, I created a base SWF...inside that I put a series of "loadMovie" calls on successive keyframes in the main timeline.
For each of those "loadMovie"s, I specified a path to the SWF file to be loaded, and a 'target' for the loaded SWF. The 'target' is a movie clip on the time line that is generally empty (looks like a little white dot), and serves only as a kind of a vessel for the loaded movie. The important thing is that that target movie clip has an instance name, because the "loadMovie" command requires that you specify one.
A typical call looks like this (from Milosav's post above):
loadMovie("movie1.swf","mc1");
Where "movie1.swf" is the SWF to be loaded, and "mc1" is the instance name a movie clip on your timeline. When you do a 'Test Movie', movie1.swf should appear below and to the right of wherever you placed the movie clip called "mc1". This is because the target movie clip represents the top left corner of the externally loaded SWF. It takes a few tries to line everything up in your design, but once you've done that once, you're done forever. Any updates/changes take place in those loaded swfs.
So far, it's been the BEST as far as my workflow...Hope this helps!
-
That does help. But where do i have to have "movie1.swf" on my computer? do i have it in the timeline or just in some folder somewhere? sorry for the annoying questions but im only 13
-
Some Guy
No problem...I imagine you're familiar with HTML and the way it references images, style sheets, etc. Basically, if you have your HTML page in a folder, and all the images it uses are in a subfolder called "images", then every image in your HTML page is called like this: "images/filename.JPG".
Well, with load movie, it's pretty similar. Let's say your SWF that loads all the movies is embedded into a page called "BaseMovie.html". If BaseMovie.html and BaseMovie.swf are in the same folder, and you make this call:
loadMovie("movie1.swf","mc1");
..."movie1.swf" needs to be in the same folder with BaseMovie.html.
Hope this helps...Good Luck!
-
i am familiar with html and that does help a bunch! thanks for everything!
-
Hi justplainsoccer,
This is all really easy in the end. I think it is harder to
visualize it than when you actualy code it.
I think that many flash users fall prey to the "I want to do
it now ... I want to see the results" and that's because the results are so cool !!! And this usually ends up with the first Movie being too large and complex. And as the Movie grows you soon start
thinking "**** ... this has turned into a house with hundreds of
little extensions ... that I have to use work arounds to use.
I think the old carpenter quote "think thrice cut once" should
be used. Spend a good deal of time thinking over your project.
Break it down into defined "modules" then when you are sure
turn on your computer.
Example. A surfing site with:
1. A current interview with surfer.
2. Current weather conditions.
3. Image gallery.
4. Video footage.
2. Navigational system.
3. preload manager.
All these would be placed in seperate .swf files which
comunicate through the actionscript you write.
The great thing is if one day you think "... that navigation
looks like ****." You can just open up the navigation.fla
file, make it ten times better and publish it and it will
plug back into your whole project.
What version of flash do you have?????
Windows Mac ?????
If ours are compatible I will make you up a small example
of a simple multiple .swf project. I will comment it heaps
so that you know what is going on and can learn as you look
through the files.
Milosav
-
movie clip
Regarding the last post... I'm curious how to make these empty movie clips so I can load into them. Can you be very specific on how to do this? I've tried reading up on it and being a beginning I am pretty lost. I am loading indepedent .swf files as well (which I've got down), but this mc load option would really help me out.
Do you make an independent .swf to load into this mc?
thanks!!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|