|
-
Preload Sound Object Problem
Hey gurus. Having a problem with a preloader for a sound object movie. Basically I'm calling up a preloader to load in an MC (clip holder) in my main movie.
The preloader loads fine in the MC (clip holder) but then the file it loads up places the SWF in the default location (top left of movie). How do I get the loader and the movie it calls up to play inside the MC (clip holder).
The MC (clip holder) has an instance "holder"
This is the main action from the frame with the clip holder in my main movie:
loadMovie("swf/loaddemo.swf", "holder");
// loaddemo.swf is the external movie I'm calling up in a SWF folder
These are the actions I have in my loading movie (loaddemo.swf):
onClipEvent (load) {
loadMovieNum("swf/demo.swf", 1);
}
onClipEvent (enterFrame) {
percentloaded = Math.floor((_level1.getBytesLoaded()/_level1.getBytesTotal())*100);
if (percentloaded == 100 && !initialize) {
_level1.mysound();
initialize = true;
_visible = false;
}
}
The problem is the preloader loads the new movie (demo.swf) onto level 1 in the main movie in the top left corner (not inside my clip holder MC). It seems logical that my problem is because it's loading onto level 1. But if I play with that number, my preloader doesn't work. Any thoughts?
Thank you.
-
general rule bender
I'm sorry, but I'm totally confused with what you are saying.
-
[sleep.less.ness]
Re: Preload Sound Object Problem
Originally posted by beachin
Any thoughts?
explain it clearer eG
 Beware Of Programmers Who Carry A Screwdriver
-
load sound object > revise
Sorry. It was kind of late last night/this morning. Let me try and be clearer:
I have a main movie (webRH4.fla) that has an Empty MC to hold a loaded external file.
The external file is actually two files (one calling up the other) from a subfolder (swf). My main problem is this is the first time I've worked with preloading a sound object. So I built the preloader from one of the tutorials to preload the external SWF file. I get the preloader to load fine (swf/loaddemo.swf). But when it loads the sound file (swf/demo.swf) it doesn't load it in my clip holder on the main movie. It loads it on top of the main movie in level 1 at the default top left corner. I realize that is what my code is telling it do, but I don't how to adjust the code in the (loaddemo.fla) file to load the sound file (demo.fla) in the clip holder on the main movie.
Here are the source files of what I'm trying to do:
http://portfoliodisc.com/site/files/sitetest.zip
When you click on the first button (demo), it jumps to the label to start the external load. I hope the source files shed a little light on what I'm trying to do. And as always, I appreciate your help.
Thanks.
-
Senior Member
Go to this site
http://www.flashkit.com/board/showth...hreadid=469151
You can download the files, which contain a preloader component for sounds. Check the actionscript inside. Although it is xml based you can see how it is done using movieclips. Sorry I don't know my scripts by heart.
- The right of the People to create Flash movies shall not be infringed. -
-
sound object preloader
Thanks cancerinform. That is a great MP3 player. I'll have to keep that one in the vault for a music based site. But I'm looking for more of an actionscript mechanic on this one. If any of you gurus have any thoughts based on my query and source files, I would appreciate it.
thank you.
-
Senior Member
Try this: In your childmovie put this script.
PHP Code:
function loadMySound(){
_root.holder.createEmptyMovieClip("clipHolder",1);
mySound = new Sound("clipHolder");
mySound.onLoad = function(success){
if(success){
trace("loaded");
checkLoading();
}else{
trace("not loaded");
}
}
mySound.loadSound("soundfile.mp3",false);
}
function checkLoading(){
this.onEnterFrame = function(){
var lBytes = mySound.getBytesLoaded();
var tBytes = mySound.getBytesTotal();
var rBytes = (lBytes/(tBytes/100));
progressBar._xscale = rBytes;
if (rBytes >= 100){
_root.goToAndPlay("frameName");
}
}
}
You can also try to put checkLoading(); after mySound.loadSound
Regarding the mp3player there are still some minor bugs. I will soon put the final version on.
- The right of the People to create Flash movies shall not be infringed. -
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
|