FORUMS: list search recent posts

Flash loading?

COW Forums : Adobe Flash

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
LGABoarder
Flash loading?
on Jun 11, 2007 at 5:32:40 pm

I've never quite understood how Flash files load. I'm beginning and endeavor to make a fully Flash webpage which could potentially be quite large and wasn't sure about the loading aspect of it. I guess I have no idea where to begin asking the proper questions so could someone explain the basics of how a flash file loads? I know that's kind of vague but hopefully it'll give me a spring board for some questions. I do plan on including pictures, externally linked text, and video (with a self made playbar) Thanks!


Return to posts index

thumbslinger
Re: Flash loading?
on Jun 14, 2007 at 8:38:08 pm

a frame in Flash will not play or show until it's fully downloaded. So, as you build the Flash file, if you put everything on the first frame, you'll have a wait, whether 2 layers or 20.

Sounds like you want to read about pre-loaders. There are some simple ones that work great and complicated ones that do not!

Here's a great one that works.

1. Open a new flash document and make it the size your actual project is going to be. Name this document preloader.fla (and keep it in a code file for later use as well) This swf is the one you want to put on your index.html page. It comes up first, loads the real file and removes itself.

Make sure the background is the same color as the background of your main file if that's a concern.

2. Choose Insert-New Symbol name it bar_mc and make sure it's a Movie Clip.

3. In that timeline on the first frame, draw a little rectangle that will represent a loading bar. So just make a little rectangle something like 100x15.

4. Go to the Main timeline and create a layer. Pull an instace of that bar_mc you just made onto the screen.

5. Highlight that instance and down in the properties inspector give it an instance name of bar_mc. (Yeah, it's the same as the actual symbol..doesn't have to be but it will work with the following)

6. Create another new layer called Actions and put this on the first frame of that layer:

stop();
//-------------preloader------
//make the preloader bar not appear "full" right away
bar_mc._xscale = 0;
//load actual Movie into level 1
loadMovieNum("NameOfYourMainMovie.swf", 1);
//note the movie to load has a blank first frame.

onEnterFrame = function () {
_level1.stop();
// get the bytes of Level 1 and make into a percent
percent = Math.ceil((_level1.getBytesLoaded()/_level1.getBytesTotal())*100);
//use the percent to determine the xscale of the preloader bar.
bar_mc._xscale = percent;
// if loaded play level1
if (percent>99) {
//note you MUST delete onEnterFrame otherwise it
//will continue to run.
this._visible=false;
delete this.onEnterFrame;
_level1.gotoAndPlay(2);

}
};

7. You're done in this file.

8. In your main file, just make sure the first frame of all layers is blank. Change "NameOfYourMainMovie.swf" to whatever you call your main movie.

Simplest one I've come across and it works everytime.

You can go here and see where I used it:
http://www.leetilford.com



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]