website promotion banner
eturnkeys
Your Ad Here
Flash & Swish  Home Flash & Swish Swish Tutorials Load all SWFs Before Play
rss

Load all SWFs Before Play

Author: garywee More by this author


Load all SWFs Before PlayHow to load all external movies before main movie start playing

Having thoughts on how to load all external movies before main movie start playing?

This is a tutorial on how to load all external movies into level + before start playing main movie.

** You'll also learn how to control movie that are loaded into level +, basic play/stop sound, control movie in levels.

You may ask, "why not place all components of external movies into one main movie and have it load altogether with a preloader?"

Ans 1: By doing this tutorial, you can run a certain movie/scene first without having to wait for the whole movie to load finish, as usually a single movie had to finish its loading before start playing anything.

Ans 2: This technique is useful for those who split their movie into small parts, keeping it neater and easy to control.

However the overall discussion will still be keeping your movie size small. It'll definitely helps in this tutorial.

It is assume that you already know how to work with levels, sprite, and Tell target.

Ok lets start the tutorial, just dealing with 2 types of external movies; effect and sound.

In other words, we're going to create 2 different types of external movies; effect.swf and sound.swf

Imagine this situation:

"I want the sound to start playing as soon as the effect movie starts."

How are we going to design the structure?

We're going to load sound.swf and stop it from playing first. Then load effect.swf. After effect.swf is loaded, then we'll activate the sound.swf. You can do another way round.

Level +

1. Open swish, save it as main.swi

2. Create another and save it as effect.swi (external swf)

3. Create another and save it as sound.swi (external swf)

>> main.swf now will be our default level (level 0), we'll load sound.swf into level 9 first, then load effect.swf into level 1.

4. In your main.swi, 400x300, place a load movie, sound.swf into level 9 at frame 0. "Stop" at frame 1. Save and export your main.swf.

5. In your sound.swi, any size, place a load movie, effect.swf into level 1 at frame 1.

6. At frame 2, set label as "stop music", and insert the "stop sound" action at same frame (import the sound u want -- .wav format). Place a stop at frame 3.

7. At frame 4, set label as "play music", and insert the "play sound" action at same frame. Place a stop at frame 5.

8. Save and export your sound.swf.

>> The reason of using "stop sound" action first is because we want it to stop playing although it's first loaded.
>> You may be wondering why there's no button created here to play and stop the sound. The reason is I'm going to teach you how to control the play/stop sound using button that are created at other levels. In this case, the play/stop buttons are created in effect.swi.

9. In your effect.swi, 400x300, insert "Tell Target", "_level9", Goto label "play sound" at frame 1, "Stop" at frame 2 . >> this action is activated when effect.swf is totally loaded and started playing. It'll play sound at the same time. It has actually accomplish what the situation is having. However we're be doing more on how to control the stop/play sound.

10. Still at effect.swi, design a button, name it "on sound" at any position you want, say bottom right. Duplicate another in the same position and name it "off sound". on should be on top of off button.

11. At frame 1, insert a "Stop" and "Tell target", "_level9", Goto label "play sound". Insert a "Place" for the Off button at frame 1.

12. At frame 2, insert a "Stop" and "Tell target", "_level9", Goto label "stop sound". Insert a "Place" for the On button and a "Remove" for the Off button at frame 2.

13. Save and export your effect.swf

Done! Place your main.swf, sound.swf and effect.swf at the same location/folder to test the file by click on main.swf to start.

You should now understand that you can control what to happen in level 9 even when you're in level 1.

Try to understand this basic 1 main 3 external swf tutorial. After that it'll be much easier to deal with more external movies.

Sprite

Read the above tutorial 1st before reading these:

(This section is more like a discussion, not a tutorial. For load movie into sprite, use the usual tell target technique)

I'd personally tested the files using loading into sprite technique. Only that i found out movies that are loaded into sprite have very limited space for 'creativity'. Because of this, the technique used is exactly the normal way of tell target action. Nothing special.

Why do i say that?

Sprite are part of a movie (main.swf), which means usually the ext. swf being loaded into sprite has smaller dimension than the main.swf. If it's of same dimension, might as well use level + technique unless masking.

The "load ext. swf into sprite" action is inserted/being-commanded in the main.swf itself. It is a must to load main.swf 1st before you can load your ext. movie into sprite.

Thus The limitation is there.

When using levels, i can choose which level i wanna play 1st, but when using sprite, i don't see the point of playing a sprite movie 1st (smaller movie), then followed by playing the main movie (bigger movie).

Up to this point, it might give you an impression of using/working level + is better than sprite (level -1).

My answer to you is "Only depend on how you want your movie to run".

In some cases, using "load movie into sprite" is better than "load movie into level +".

However i knew members always prefer to use only their preferred technique because it's simpler to them.

My advice is learn both and use both if needed. If not members are going to run into trouble.

You're welcome to post the situation you're in and My co-mods/squad-members will advice u on whether to use sprite technique or level + technique. Not only to advice you, they'll also explain to you why which is better in your situation.

* Only 1 situation per post



Author's URL: www.swish-db.com

Rate this Material: Bad 1 2 3 4 5 Excellent
print this page tell a friend subscribe to newsletter subscribe to rss

Add comments to "Load all SWFs Before Play"