ActionScript 3.0 :: Making A Sound Play Once Then Stop?

Dec 14, 2009

When my avatar bug makes contact with another type of bug, he eats it. Both bugs are movie clips; when the avatar gets into the collision detect zone of the edible bug, it triggers a quick animation in the "edible" bug: he becomes a blur for one frame then disappears (as though eaten).

The problem is the sound effect - a quick "whoosh". It needs to play once then stop. What happens now is that it's triggered repeatedly - a problem if the avatar passes over the edible bug slowly. If the avatar later passes over the spot where the edible bug was, the sound is triggered multiple times again. So I need the sound to play only once, then stop. There will be several copies of the edible bug's movie clip that need to behave the same way, so once the sound stops playing it needs to be available again for the next collision.

Here's what it looks like now:

private var sfx_edible:Sound = new eat();
function detectCollision(myevent:Event):void {
if (avatar_mc.hitTestPoint(edible_a.x, edible_a.y, false)==true) {

[code]....

View 1 Replies


Similar Posts:


ActionScript 2.0 :: Play Sound/stop Sound Button?

Feb 13, 2007

i want to make a single button to play a sound, and if pressed again, stop the sound. and if pressed again, play the sound, and so on...
i know it has to be made with a boolean variable, true/false, but i just can't figure out how.

View 13 Replies

ActionScript 3.0 :: Making Sound Only Play Once?

Sep 22, 2010

the site i'm currently helping out with has an audio clip that gets loaded in through xml, I want this to only play once and then halt, but if the user wanted to click on the volume button it could start on up again without a hassle.

View 4 Replies

ActionScript 3.0 :: Making Sound Play Through All Scenes?

Aug 26, 2010

I have only two days to get this working and handed in. My class did not teach actionscript, the code for keeping sounds playing through multiple scenes was provided for us :

var mySound:Sound = new soundtrack();
mySound.play();

Unfortunately this doesn't seem to work in actionscript 3..... and my entire movie is actionscript three. It won't let me save down or convert it or anything.... and I can't get my stuff into another file without screwing it all up.

View 4 Replies

ActionScript 2.0 :: Making Sound Stop In Embedded YouTube Player After Removal

Mar 18, 2011

I have the site: [URL]

There are videos there and they play fine and get removed when I change pages. The problem is, if I leave a video playing and then switch pages the sound continues even though the video disappears. How can I make the sound stop? I have done quite a lot of research. My video's appear code is:

Code:
this.createEmptyMovieClip("video_mc",10000);
this.video_mc.loadMovie("youtube video");

[Code]......

View 5 Replies

ActionScript 3.0 :: Making A Sound Play At Exact Millisecond?

Jan 9, 2011

I'm having trouble making a sound play at an exact millisecond sinde framerate and timers are not 100% precise. First I tried creating a timer and playing the sound every second. But this causes delay. I can't think of any other way... I'm trying to create a game that marks the rythm precisely by playing small sound clips every specific amount of milliseconds.

View 3 Replies

ActionScript 3.0 :: Making A Flash App - Sound Play Delay?

Apr 3, 2004

I am trying to develop my first flash app. The application emulates a "karaoke" service. It plays a background sound and at the same time records the sound coming from the mic. I use the "sound" class to play the sound (s.play() ) and the "netStream" class to record the mic sound (ns.publish("mysound", "record") ). In the same app, I then try to play these two sounds together. The problem is that I cannot synchronize them. My tests drove me to a conclusion which I am not certain for. The conclusion is that the method s.play() has a delay about 500ms until the sound starts playing. The result is that recording starts 500ms earlier than playback. When, then, I playback both of them the recording sound is 500ms after the backround sound. Is that delay for sure true?

View 12 Replies

ActionScript 3.0 :: Making External Sound Files Play Instantly?

Feb 27, 2011

I could create a program for him in flash which would be able to play sounds corresponding to keys on the keyboard, but split in to 3 groups, and only 1 sound from each group can be playing at a time. I don't know that much about as3, and I told him this but said I would try anyway. The first thing I came up with was this:[code]In there, there's nothing to stop the sounds overlapping or looping like in my other solution, also it's obviously a lot less compact, but I sent it to my friend like that to see if it would at least play instantly. The response I got was that, although the lag was noticeably less, it was still present.

View 3 Replies

ActionScript 2.0 :: Play Sound Like "stop All Sound" Option In Flash?

May 17, 2003

I want to use a sound loop in my flash movie. The movie has many scenes. And the problem is that when I go to next scene or different scene I hear the sound repeating twice. I mean sound does not stop from first scene and begins from the different scenes.Is there any way to play sound like "stop all sound" option in Flash.

View 6 Replies

ActionScript 2.0 :: Mp3 Sound - Play And Stop

May 2, 2006

I made to player with only the buttons play and stop, I tried to make that button toggle, but I did not works, then I made two buttons, when I click in play it shows a button and hides the other and vice versa, he functions normal, my problem is the following one:
When finishes the music the button not return for stop button, it continues showing to the animation of the play button , How can I make when to finish the music the button comes back to the state where it was.

[Code]...

View 2 Replies

ActionScript 2.0 :: Stop A Sound Then Play Another And Back To It ?

Sep 4, 2010

Stop a sound then play another then back to it ?look at the Attachments files

View 2 Replies

ActionScript 3.0 :: Play / Stop Sound On One Button?

Jan 27, 2011

When you click the first time on the button, it should start the song, when you click a second time on the button, it should stop the song. how do i make this with actionscript 3?

View 1 Replies

ActionScript 3.0 :: Play Sound Automatically Stop Another?

Jan 11, 2010

I have 2 samples that play with a click on a button, however, I want one of them to stop playing if the other one is played; so that only one sound will ever play at any one time.

View 9 Replies

ActionScript 3.0 :: Play Sound In First Class And Stop In The Other One?

Apr 9, 2010

I am trying to make some sound script for my website, but I need to stop the sound when portfolio's class will open.[URL]

View 7 Replies

ActionScript 3.0 :: Make The Sound Play First And Then Stop It?

Feb 10, 2011

make the sound play first and then stop it?

var music:Sound;
var trans:SoundTransform;
var channel:SoundChannel;
var musicOn:Boolean = true;

[code]...

View 0 Replies

ActionScript 2.0 :: CS3 Making A MovieClip Play It's Frames, Then Stop On A Main Timeline Frame?

May 12, 2010

I am currently in the middle of making a "sniping" flash game. In the first level there are a series of moving targets which are also movie clips. Inside the movie clip there is a 7 frame animation of the target exploding. Inside that is a tween of the target moving up and down. And inside that there is a plain old button.

What I want to happen is when you click on the moving target it explodes and brings you to a new frame of the main timeline. (ex. Main Timeline frame #27) But I'm pretty sure it thinks I was to play the seven frame animation of it exploding and then go to frame 27 inside the movie clip, rather then frame 27 on the main timeline.

Here's what my AS looks like on the target (ActionScript 2.0 is what I'm using.)

on (press) {
play();
}
on (release){
gotoAndStop(27)}

So how do I make it explode and then take me to frame 27 on the main timeline?

View 3 Replies

ActionScript 2.0 :: Control Sound With Play And Stop Buttons?

Mar 29, 2004

I am trying to control Sound with actionscript and play and stop buttons.

This is the script I have in frame one of my scene.

[Code]...

playB is the instance of the play button stopB is the instance of the stop button the sound intro is on its own layer and is selected as a streaming sound. My problem is that when I stop and start the sound with the buttons the sound starts from the beginning instead of playing from the frame it is in.

View 3 Replies

ActionScript 1/2 :: Pause, Stop, Play A Sound That Is Loaded From The Other .swf File?

May 6, 2009

Pause and Resume external SWF sound filesI have this code that plays the sound through linkage. It reside in scene1.fla -> scene1.swf.

var mc:MovieClip = this.createEmptyMovieClip("mc",1);var myLoop:Sound = new Sound(mc);myLoop.attachSound("bg_sound");myLoopVolume=0;myLoop.setVolume(myLoopVolume);
mc.onEnterFrame = function () {  if (fadeIn01==1) {  

[code].....

View 1 Replies

ActionScript 3.0 :: Stop Only Flv Video Sound And Continue The Bg Music To Play

Sep 3, 2010

I made a webiste with bg sound home, portfolio, gallery, contcts. This  are the links. when click portfolio, which contain a flv file, when  clicking the flv file bg music stop and video will play smoothly.But if i  navigate to other links the sound from the flv remains their and my bg  music not playing also.. one code SoundMixer.stopAll();  i got this code  b4, it vil stop all sounds... i dnt need to stop the background music, i  need to stop only my flv video sound.. there's a bg music playing, when  entering to the portfolio section thers a flv video vth sound. i can  stop all other sounds ven playing this flv video but i cant stop this  sound ven navigating to other sections and i need to continue the bg  sound ven navigating to other sections...

View 1 Replies

Actionscript 3 :: Sound Performance In Loop - Stop And Play Again For Synchronous

Jun 2, 2011

i am using soundmanager to order sounds. my site preview, in home page, square shapes comes into stage and you can drag drop them, all shapes binded its own sound. if they are colliding binded song will play.

the problem is i have 3 second timer to control sounds. every timeout i have to stop sound and play again for synchronous issue, that is my solution for that part. but sometimes before loop, there is an annoying little silence.

View 1 Replies

ActionScript 3.0 :: Flash Play Stop Root Timeline Sound?

Aug 15, 2010

I have added some three sound clips, play pause buttons, on the root timeline in a movie with corresponding callouts. I am able to stop all sounds on the main timeline by below

stop_btn.addEventListener(MouseEvent.CLICK, stopSound);
function stopSound(event:MouseEvent) {
SoundMixer.stopAll();
}

But now how do I resume all the sound to play. In sort, mute unmute root sounds in AS3.

View 1 Replies

ActionScript 3.0 :: Sound - When Press Stop Then Play It Only Plays From The Last Pause And Not The Beginning

Apr 26, 2009

i'm habing abit of problem with this code, its supposed to play pause and stop, the problem being that when i press stop then play it only plays from the last pause and not the beggining how to get it to play from the start after the stop button is pressed

[Code]...

View 1 Replies

ActionScript 3.0 :: Controlling Sound File With Play Stop And Mute Button

Oct 6, 2010

the method for stopping/playing sound in 2.0 don't work for 3.0. i can stop the sound by going to a different page/frame on the site.but i want the buttons.

1. play button?

2.stop button?

3.mute button?

View 1 Replies

ActionScript 2.0 :: On The Mouseclick Rollover Loop To Stop And The Down/click Sound To Play?

Aug 16, 2009

I created a movie clip that I am using as a button. I created the states in the clip (up, down, over) and the graphics work, but the sound is driving me crazy. I have a rollover loop that plays and a special click sound on the down/press. On the mouseclick, I want the rollover loop to stop and the down/click sound to play. Also, a getURL is happening on the release. Basically, everything works, except you can't hear the down/click sound. All sound just stops on the click.THis is AS2. Here's my code on the first frame. In the clip/button itself, I have the states labeled, the sounds placed using the properties and a stop on each keyframe of each state.:

playa.onRollOver = function() {
playa.gotoAndStop("_ovr");
}[code]/.....

View 1 Replies

ActionScript 3.0 :: Add A Sound File To Project With Controls To Stop And Play And Volume Slider

Dec 6, 2009

I'm new to Actionscripting and I want to add a sound file to my project with controls to stop and play and a volume slider. I'm using this actionscript for the controls. It works but right now you need to click the play button for it to start. Is there a different way to write it so that the music starts playing when the scene starts, and then the user can stop or play it again and change the volume?[code]

View 3 Replies

ActionScript 2.0 :: Bar - Play And Stop Button To Play And Stop Frames In A Flash Movie

Dec 1, 2004

give me the actionscript for a bar that has a play and stop button to play and stop frames in a flash movie. i would be gratefull if you could as i am really stuck

View 2 Replies

ActionScript 3.0 :: Stop Button Sound But Not Main Background Sound?

Aug 5, 2010

I have a bit of a problem with sound.. I have a main container animation with background sound that's loaded with soundChannel..I also have an externally loaded SWFs with Movie Clip buttons that have a sound ON ROLLOVER on the timeline..after rolling off - I place the:SoundMixer.stopAll();to stop the button from playing the sound once the mouse is rolled off.. However, the problem I'm running into is that it also stops the sound of the main container movie cli

View 1 Replies

ActionScript 2.0 :: Sound - Stop Button To Allow The User To Stop Mid Song

Mar 13, 2007

i have programed a play button using:

[Code]...

now i am trying to program the stop button to allow the user to stop mid song....

View 4 Replies

Sound Stop All Sounds Works / Then Sound Starts Again?

Jan 5, 2010

I am using FLASH CS3.I have gone through many posts, seems to be an issue with many people.Still haven't come across a fix.Website made in FLASH. Flash movie loads and sound works great!I have a button with 'StopAllSounds' action script.[code]When I go back to main page... sound starts up again.Is there a way I can stop all sound regardless of where the visitor goes on the website?

View 2 Replies

Stop Sound From Going Into Next Scene While Keeping Button Sound?

Oct 19, 2010

I'm sure this is a common problem, I tried looking around on the forum for a problem like mine but was unable to find anything. I'm using Flash CS3, Actionscript 2.0, and am making a soundboard. I have two scenes, one that's the title screen, of which has a sound file loaded via the timeline, (I think) set to Event and Loop, and a button which takes you to the next scene and makes a short sound when it's pressed. My second scene has background music as well, also set to Event and Loop.

Problem is that when I press the button, the background music keeps playing into the next scene. I tried using putting stopAllSounds onto the button, but that makes the sound of the button stop as well, and I'd really like to keep it. I've been messing with this for days, and I can't figure it out.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved