Problems working with sounds (MC vs. main timeline)

  • CHEVALIER
  • Born
  • Born
  • CHEVALIER
  • Posts: 4

Post 3+ Months Ago

Hello everyone.

I'm working on a presentation with differents audio files, and I need some help ASAP.

In my main timeline, there's an audio attached to a frame, set to loop. That's ok, because I do want it to never stop. This is the soundtrack.

The problem is with the audio set to play IN a MC's (mc01) in the main timeline. The audio is attached to its 5th frame, using this code:

Code: [ Select ]
    loc03 = new Sound();
    loc03.attachSound("loc03");
    loc03.start(0,1);
  1.     loc03 = new Sound();
  2.     loc03.attachSound("loc03");
  3.     loc03.start(0,1);


In this same MC, there is a button to interrupt the MC animation at anytime and return to the maintimeline. It works, but I can't figure out how the button can interrupt the sound (loc03) as well. It returns to the main timeline, but the sound keep playing until it reaches the end of the audio file.
I don't want the sound in the main timeline to stop. Only the sound in the MC.

How would the button stop the sound in the MC when it's pressed?!?

Any ideas?

Thanks a lot!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • CHEVALIER
  • Born
  • Born
  • CHEVALIER
  • Posts: 4

Post 3+ Months Ago

Hey! I finally made it...

I solved the problem adding a new line of code, and then initialized the sound with a movie clip...

So the final working code is:


Code: [ Select ]
var loc03:Sound = new Sound();
loc03 = new Sound(soundon); // soundon is the "omnipresent" MC
loc03.attachSound("loc03");
loc03.start(0,1);
  1. var loc03:Sound = new Sound();
  2. loc03 = new Sound(soundon); // soundon is the "omnipresent" MC
  3. loc03.attachSound("loc03");
  4. loc03.start(0,1);


and in the return button:

Code: [ Select ]
on (release) {
loc03.stop();
_root.gotoAndPlay ("frame");
}
  1. on (release) {
  2. loc03.stop();
  3. _root.gotoAndPlay ("frame");
  4. }


go figures... I need to take some AS classes... lol
anyway, there goes the solution for some AS noob like me...

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 10 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.