PDA

View Full Version : Sound Stacking


Porr3
03-16-2007, 02:38 PM
Hi.

I've been working with Action Script for a few days now and I am trying to make a slideshow with music. I have 3 different scenes and my first scene's background layer (first frame) have this code:

StoneMusic = new Sound(this);
StoneMusic.attachSound("IntroBGM");
StoneMusic.start(0, 99);

And when I start my movie, the sound plays. BUT when I click on a button to jump to another scene and frame, and then go back to the previous frame where the music started. Another instance of the song starts playing. I need help with solving this.

I tried some noobish attempts like

StoneMusic = new Sound(this);
StoneMusic.attachSound("IntroBGM");
BGMcounter;

if (BGMcounter = true){
StoneMusic.start(0, 99);
BGMcounter = false;
}

but it still did not work.

Summary: I need help so my music wont stack on eachother


Thanks

WhidbeyTomas
03-17-2007, 09:42 PM
Ok, 0/27 response to view ratio immidiately activates my response mechanism. I can think of four root causes to insufficient response:

The poster is asking for too much (I can't do it, will you?)
Not enough information
Poster addresses technology outside audience capability
The post is unfocused (multiple unrelated questions) and we don't know where to begin

Your crime is insufficient information. I really don't know enough about your information strategy to see where you go wrong. You can rectify this by providing more code, either by including it in your post or by moving code to a text file and attaching that to your post (FLAs are usually too big).

If I were to guess your problem, I would lean toward problems with path. You use scenes (which I understood to be depricated by Flash). I think scenes complicate things (especially content loading).

If I were to design a strategy, I would make each slide an object with its own self-contained code (you can duplicate this to every other object). This object code would unload sound when the user navigates away. But there are many ways to boil this egg.

So, you can try my strategy, or we might get a different suggestions from others. Or you might provide more information, so we can assess your strategy for conflict.

Good luck!

Porr3
03-18-2007, 12:32 AM
Thanks for your reply

To put it more simply.

If I were to press a button which plays the sound "Ding, Doong". Is there an easy way of making the button not play "Ding, Doong" again when clicked if the first "Ding, Doong" sound hasn't finished?

WhidbeyTomas
03-20-2007, 02:23 AM
But I could find a kluncky way to do it. You might set the button to invisible in the onRelease eventhandler and then visible again on the last frame of the sound MC.

If I didn't want the button to completely disappear, I might have another MC that looks just like the button (but subdued) in the same location on a different layer. I would use the _visibility property to switch between the two MCs. Obviously, the subdued MC would have no event handler (unless we wanted to place an event handler there to control visibility).

I hope this rambling makes some sense to you.