all groups > flash actionscript > september 2007 >
You're in the

flash actionscript

group:

Sound from External swf


Sound from External swf flashjen
9/10/2007 8:17:20 PM
flash actionscript: I have a main movie (index.swf) that preloads my external SWF that is a menu
button 4.swf
My index.swf has background music (song1) that plays on load. I also have
background music (song2) that plays on my 4.swf
It works fine when I test 4.swf directly however when I load my main index.swf
I do not hear the song2.
I used stopAllSounds(); in my4.swf to stop the background music (song1) and
then load my song2

stopAllSounds();

my_sound = new Sound(sound_loop);
my_sound.loadSound("4.mp3",true);
my_sound.start(0,100);

This has gotten me to get both songs to play when the site is loaded and when
I click on my menu for 4 button all the sound stops and my song2 never plays.
My actionscript is not very good so any details you can give would be greatly
appreciated.
Thanks much!
Re: Sound from External swf kglad
9/10/2007 8:32:10 PM
Re: Sound from External swf flashjen
9/10/2007 8:34:38 PM
All the files are in the same directory index.html, 4.mp3, index.swf, 4.swf
Re: Sound from External swf kglad
9/10/2007 8:44:24 PM
the code you showed is the code that plays when 4.swf loads and it works as expected?

Re: Sound from External swf flashjen
9/10/2007 8:54:53 PM
Yes, 4.swf works as it should
The main movie, index.swf has a menu bar with loads all the external swfs.
Actually the button does nothing the loading is done the actionscript at
loading.

var movie:MovieClip =
_root.StoredActions.Holder.Movies.Holder2.CMovie.duplicateMovieClip("CMovie" +
n,n);
loadMovie(n+".swf",_root.StoredActions.Holder.Movies.Holder2["CMovie"+n]);
if(n>1){
_root.StoredActions.Holder.Movies.Holder2["CMovie"+n]._x = 3000;
}
var MovieLoaded = 0;
percent = 0;
Re: Sound from External swf kglad
9/10/2007 9:01:14 PM
you mean 4.swf works without problem when you open 4.html in a browser window
but when you open index.html in a browser window, 4.swf is loaded but its sound
does not play?

if yes, to above, using the correct paths, zip index.fla, 4.fla and 4.mp3 and
post a link
Re: Sound from External swf flashjen
9/10/2007 9:25:19 PM
This is correct 4 works with no problem but when it loads from index both songs play!
I have the files zip at http://www.sheersol.com/client/caleb/index.zip
Re: Sound from External swf kglad
9/10/2007 9:52:09 PM
Re: Sound from External swf flashjen
9/10/2007 10:07:04 PM
Re: Sound from External swf flashjen
9/10/2007 10:11:05 PM
Re: Sound from External swf flashjen
9/10/2007 10:42:39 PM
Re: Sound from External swf flashjen
9/10/2007 10:52:35 PM
here is frame 3 of my loader in index.fla
var movie:MovieClip =
_root.StoredActions.Holder.Movies.Holder2.CMovie.duplicateMovieClip("CMovie" +
n,n);
loadMovie(n+".swf",_root.StoredActions.Holder.Movies.Holder2["CMovie"+n]);
if(n>1){
_root.StoredActions.Holder.Movies.Holder2["CMovie"+n]._x = 3000;
}
var MovieLoaded = 0;
percent = 0;

frame4
MovieLoaded =
_root.StoredActions.Holder.Movies.Holder2["CMovie"+n].getBytesLoaded();
loadTotal =
_root.StoredActions.Holder.Movies.Holder2["CMovie"+n].getBytesTotal();
percent = int(MovieLoaded/loadTotal*100);
Bar.gotoAndStop(percent);
loadingName = ("Loading... " + percent+ "%" + " of "+ n);
Loadtext_txt.text = loadingName;
if (loadTotal>10) {
if (MovieLoaded>=loadTotal) {
gotoAndPlay(6);
}
}

frame6
if (n < _root.StoredActions.nMenus) {
n++;
gotoAndPlay(3);
} else {
gotoAndStop("Stopload");
_root.gotoAndPlay("Play");
}

I know that the above code is loading all the external swf and causing the
music to start after load. Is there a way to stop it from loading the sound?
Re: Sound from External swf kglad
9/10/2007 11:56:26 PM
you have a coding problem in index.fla. to determine what that is will require
more than a little effort because your coding technique.

there may be others in this forum that would be willing to help you without
charge. but i'm unable to help you with this unless you want to hire me.
Re: Sound from External swf flashjen
9/11/2007 12:03:09 AM
Re: Sound from External swf flashjen
9/11/2007 12:04:18 AM
Re: Sound from External swf kglad
9/11/2007 12:56:11 AM
AddThis Social Bookmark Button