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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sound functions don't work when use loadMovieNum ... 1

Status
Not open for further replies.

Chris99

Technical User
Jan 11, 2001
18
CA
Hi everybody, hope someone else here has encountered this same problem and solved it - because I've tried just about everything.

I made a swf (movie#2) with sound functions. When I play that swf by itself, sound functions work fine, no problems. Here's an example of one of my sound functions (placed on 1st frame, 1st layer). I use Flash MX,

function BopSound(){
bop = new Sound();
bop.attachSound("Bopmusic");
bop.start(0,999)}

And then I call the function wherever by _root.BopSound();

But .. when I load that same swf into a another swf (Move#1) via loadMovieNum("movie#2.swf", 1),

the sound functions don't work anymore. Do I maybe have to specify a level (_level1 something or other?) when calling the function? Is it a shared resource matter or something? I am guessing at this point ;)

If I redo my souond nctions in the _level0 swf (movie#1) and reimport those same sound files also into that movie then the sound functions within what is now _level1 work. There has to be a way around this.

Why on earth would a sound function in a swf work fine, but not when you load that swf into another movie? Does the swf lose all track of what's in its library, what's for export, etc, just because it's loaded into another swf? Doesn't make sense.

Any advice or comments how to solve this would be most appreciated, thank you :)


I want to Learn :D !!
 
Although MM says the parameter is optional, it isn't, so just add this to your soundObject's definition, and it should then work fine...
Code:
function BopSound(){
    bop = new Sound([b]this[/b]);
    bop.attachSound("Bopmusic");
    bop.start(0,999)
};

Adam14, if you read this, hope you understand it now!
 
Hi oldnewbie, I can't thank you enough for solving this. All my sound functions work now even though they exist within a swf loaded into _level1 now via loadMovieNum() :)

So many other people told me that attachSound() won't work if your swf is loaded into another swf via loadMovieNum() unless that same sound is also available in the "host" swf library.

Guess I should always come here for help 1st, huh? ;) !

Bye and thanks again, Chris99 :)

I want to Learn :D !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top