Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Preloading a movie that uses linkage 1

Status
Not open for further replies.

bubu

Programmer
Mar 3, 2002
463
0
0
RO
Hi there all you guys!
I have this movie in which I load from the library 20 mp3s using Linkage. Everything works fine. If I add the preloader these mp3s will load on the first frame so normally that my preloader won't start from the begining it actually starts from 47%.

I did another movie that has a blank container that loads that big swf into and I use this movie as preloader...clasic solve to the linkage things preloding.

But now I have another problem...my sounds don't start. So if I won't use this new movie as preloader all the sound work just fine but the preloader doesn't . If I use the new movie to preload the preloader is just fine but the sound won't start.

Code used to add a sound object (in the main movie):

Scene5_sound = new Sound();
if (Scene5snd_playing!=true) {
Scene5snd_playing=true;
Scene5_sound.attachSound("Scene5Snd");
Scene5_sound.start(0,1);
if(_global.audio=="on"){
Scene5_sound.setVolume(70);
}
else{
Scene5_sound.setVolume(0);
}
}

1. Movie (in which I have the sounds) structure:
_root.main_mc so all the content is in a movie that is on the first frame.

2. Preloader movie has a container_mc (instance name) with this clasic code:

total=_root.container_mc.getBytesTotal();
loaded=_root.container_mc.getBytesLoaded();
kbloaded=int(loaded/total*100);
if(kbloaded==100){
gotoAndPlay(22);
}

percentage=Math.round(_root.container_mc.getBytesLoaded()/_root.container_mc.getBytesTotal()*100);

So basicaly my question is why all the sound are not working when using the new movie as preloader...to solve the linkage preload case.

Thanks a lot!
Dragos.




Regards,
Dragos.


 
2 suggestions...

1- Add this to your soundObject definitions...

Scene5_sound = new Sound(this);
...

2- Once preloaded, rather than have the container play or whatever, immediately re-load that movie on level 0, with...

loadMovieNum("yourpreloaded.swf", 0);


Regards. Affiliate Program - Web Hosting - Web Design
 
Hi there,

Oldnewbie, I have reloaded the movie on _level0 at the end of that preloader movie and it works like a charm...although the whole preload, load on _level0 seems like a quick improvisation for me it works.

Thanks a lot!


Regards,
Dragos.


 
1 question though....if I am viewing this Flash movies with a browser that has cache disabled? .... then that loadMovieNum("yourpreloaded.swf", 0); .... won't work right away.....so I will have nothing...


Regards,
Dragos.


 
Since when it's preloaded, that movie is now cached, then the re-load is immediate.
The reason for re-loading it on level 0, is to avoid you having to re-script your movie with relative paths rather than most probably the absolute paths you've used. All references to _root when the movie is loaded in a container clip, now wrongly point to the root level of the main movie, rather than to the root level of the loaded movie itself. By re-loading on level 0, thus replacing your previous movie with the loaded movie, you are in fact, re-establishing the correct pathing.

In your case, outside of some code that may not have worked because of absolute paths, since you didn't reference your soundObjects to some movie clips, they were referenced by default to _root, so when you loaded your movie in another main movie, again those references now pointed to the root level of the main movie, and not the root of the loaded movie itself where those soundObjects were referenced to.

Regards. Affiliate Program - Web Hosting - Web Design
 
between the loading loop and the reload of the movie there are 20 frames...on a 25f/s framerate...do you think that disable caching in the browser won't be a problem?

Now, with the cache enabled everything works just fine.

If I add (this) to that code for defining a soundObj...as your 1st suggestion, the sounds start but they are overlapping....I have a background sound that has20 as volume, and when the others sounds start, a voice actually not a music, the volume for the background music is set to the voice's volume...I think because all the soundObjects have the same target...."this".

mainSound.setVolume(20); (for the background music)
Scene5_Sound.setVolume(70); (for one of the other mp3s...that is a voice)



Regards,
Dragos.


 
Thanks oldnewbie.

1 question though....if I run the movie on a slower computer for example AMD 950Mhz, 256SDRAM the movie and voice won't be syncronized....but when I run the movie on a better machine....movie that is on-line...so I access the adress where the movie is ... the voice and animations will be perfectly syncronized.





Regards,
Dragos.


 
oldnewbie...I read that article too...thanks a lot...usefull as always ;)

Let's say that I have all my sounds on the timeline with Sync set to Stream. How can I control them in this case...let's say I have 5 sounds across my timelins...and I want to add Volume(30) to Sound5 ... how can I do that? I mean ... in this case I won't define any sound object....my sounds are in the library but there is no Linkage....so no sound identifier.



Regards,
Dragos.


 
Hi there,

...the presentation works perfect in all the browsers that have chache enabled...but if the cache is disabled the presentation will be loaded once again...under a blank screen...as the preloader movie has reached it's end.

Check it out here:

This is a real bug...but I am sure we can work it out somehow...if I will remove that loading on _leve0 then the sounds won't start....check it out ... I will too and let you all know....

Regards,
Dragos.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top