ActionScript 3.0 :: How To Use Timer To Pause Sound

Jun 7, 2010

I have a couple of buttons that start and stop sound, and I understand how to use a timer so that I can pause sound also. What I want to do, however, is have a sound play as it enters a particular frame and then stop upon entering another frame. As a means towards getting this to work, I experimented with a button that starts a sound on frame 1 and then a second button which stops it on frame 2. This works great as long as both buttons are present on the frame where the AS is introduced (which seems inconvenient as one has to be placed off screen, but whatever...).

When I switch around the name of the functions called upon by the eventListeners though, so stopSound is on frame 1 and startSound is on frame two, it plays when it gets to frame 2, but won't stop when it goes back to 1. I seem to not be getting the principle somehow, because if the functions are play on 1 and stop on 2, I can go back and forth endlessly. How can the order make such a difference? How can I get around this? How can I design an MC to have a sound associated with it so when the playback goes to the frame it is on, it will play, and then how to stop it later on?

Here's the very simple code I'm working with:
stop();
var soundReq:URLRequest = new URLRequest("TheCattleCall.mp3");
var sound:Sound = new Sound();
var soundControl:SoundChannel = new SoundChannel();
sound.load(soundReq);
[Code] .....

View 1 Replies


Similar Posts:


ActionScript 3.0 :: Cs3 Pause Timer - Pause Each Time In The Last Frame For 8 Seconds And Loop Only 3x

Aug 2, 2009

I have some banners I am doing right now and have a pause timer question. I am fairly green at coding. In my first frame I have this:

[Code]...

I want it to pause each time in the last frame for 8 seconds and loop only 3x. Is there a better way to write this? I know all my code should be in the first frame but I still suck.

View 2 Replies

ActionScript 3.0 :: Flash - Add A Play/pause Btn That Will Pause Both Pictures And Sound?

Dec 16, 2010

I have a timeline of 30 frames, each it's own mc (page01_mc, etc.). In each mc I show a picture or two and hear narration.I have a first, prev and next nav on the main timeline. I need to add a play/pause btn that will pause both pictures and sound. I assume I do that in each mc, but do not know where to find the code.Here is what is in each mc now:

var mySound:Sound = new Sound();
mySound.load(new URLRequest("english/Intro01.mp3"));
mySound.play()

View 1 Replies

ActionScript 3.0 :: More Than One Pause Timer?

Feb 13, 2009

I'm animating a sunset and would like it to pause for a few seconds between motion tweens. I have one "pause" timer set up in
actionScript:

this.stop();
var timelinePause:Timer = new Timer(6000, 1);
timelinePause.addEventListener(TimerEvent.TIMER,[code].....

but when I add another in a later frame, I get these errors: 1151: A conflict exists with definition timelinePause in namespace internal.

View 2 Replies

ActionScript 3.0 :: How To Pause A Timer

Oct 29, 2011

how to make a crappy game, and one of them was a pause button , i managed to add all the other things in, but im absolutely stumped on a pause button. I read one tutorial, which didn't really help. it was talking about a main game loop and all that crap that just baffled me. i did try it though, and i did not get any errors, just ALOT of laf, becaus what i did was put all my constructor code into the 'update' function, so it was running my spawn enemies every frame ect. but the i realised all i need to do is pause my timer, because thats the only thing that really needs to be done right?

here is my timer:
 
public function setCrates()
{
DropCrate = new Timer(10000+Math.random()*10000,1);
DropCrate.addEventListener(TimerEvent.TIMER_COMPLETE, newCrate);

[code]....

View 19 Replies

ActionScript 2.0 :: How To Pause The Timer

Jan 16, 2009

i am working on a 30 second timer for a game. I am wondering how can i pause the timer.Id like when i click something--the timer stops. then resumes when i close it. Do i create another function to do that?

displayTime = 30;
countDown = function () {
displayTime--;
if (displayTime == 0) {

[code]....

View 3 Replies

ActionScript 2.0 :: Way To Pause The Timer?

Mar 30, 2005

Im using a function to simulate a timer

[code]...

I just can't find a way to pause that timer... Also if i move to frame 2 (this is frame 1) and move back to frame one, it doesn't seem to stop.

View 2 Replies

ActionScript 3.0 :: Pause Timeline With Timer?

Apr 1, 2010

The main timeline has a movie that consists of three frames that are supposed to hold while a sound clip plays. I was thinking of having a timer for each of the three frames instead of putting like 600 frames in the movie. I did it this way in those three frames, just changing the timer variables[code]...

View 2 Replies

ActionScript 3.0 :: Pause The Timer And Restart That?

Aug 21, 2009

how to pause the timer and restart that

View 2 Replies

ActionScript 2.0 :: Pause A Timer Function?

Mar 28, 2010

I have written a timer code but now i want to be able to pause the timer on the click of a button...i have searched all over but cannot find what i am looking for.

View 8 Replies

ActionScript 3.0 :: Using Timer To Pause Playhead?

Dec 15, 2010

Using AS3, when a playhead enters a frame, can the movie be paused for 5 seconds, and then the playhead scripted to go to the next frame?

View 1 Replies

ActionScript 3.0 :: How To Pause Countdown Timer

Jan 17, 2011

Im creating a simple hidden object game in Flash AS3, however Ive got a bit stuck.

When the player finds the objects, I have created a code which takes the player onto the next frame, code below:

var founditems:int = 0;
gun_mc.addEventListener(MouseEvent.MOUSE_DOWN, objectFound1);
function objectFound1(e:Event):void {

[Code]....

View 1 Replies

ActionScript 3.0 :: Pause Timer And Resume?

Mar 13, 2012

Is it possible to pause timer and resume?

View 5 Replies

ActionScript 3.0 :: How To Get Timer To Create Pause

Mar 30, 2011

I know you can trigger a function by adding through a timer like this i ActionScript3:
Code:
myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerDone);

But what I'm trying to do is just have a timer create a delay in between a couple of statements within the same function. Is that possible? Something very simple would do, like

public function changeVar():void {
myVar = "red"
xxxTIMER CODE HERE
myVar = "blue"
}

How do I leave myVar equal to red for 5 seconds and then have it change to blue?

View 4 Replies

ActionScript 1/2 :: Banner Slider - Timer Needs To Pause

Oct 27, 2010

I'm making a bannerslider that's going every 7 seconds to the next Movieclip/Image. But I made a play and pause button in it so that the timer would pause. But my problem is that the Timer doesn't pause.

My AS is as follows:
slides = 5;
//<------- Hoeveel afbeeldingen er staanwait = 7;
// <------- Aantal seconde per afbeeldingplayclip._visible = false;
contentHold.content1.button.onPress = function() { getURL("[URL]", "_self");};
[Code] .....

View 16 Replies

ActionScript 3.0 :: Pause Frame Change Timer On Rollover

Oct 12, 2009

how I could go about pausing this timer on rollover of an object, stage... anything? I am just cycling images on the main timeline via this timer but would like the timer to pause if a user has mouse over one of the images.

[Code]....

View 3 Replies

ActionScript 2.0 :: Pause Countdown Timer By Clicking Button

Mar 4, 2010

I have a code for countdown timer. I just want to pause the timer, clicking a button. How can I do that?

Code:
var timingMinute:Number = 10;
min_txt.text = timingMinute-1;
//Timer code//
//displayTime = timing;
displayTime = min_txt.text;
countDown = function () {;
[Code] .....

View 3 Replies

ActionScript 3.0 :: Timer Class: Precise Pause And Resume?

Jun 13, 2010

i have a mc with a slideshow nested on the main timeline and two buttons with a simple code to pause and resume:

ActionScript Code:
pause_btn.addEventListener(MouseEvent.CLICK, onClickPause)
function onClickPause(event:MouseEvent){

[code]......

View 7 Replies

ActionScript 3.0 :: Use The Timer / Setinterval Function To Pause The Animation Between Tweens

May 11, 2009

I have been having trouble with the timer, knowing how to plug into the scripts/Functions the correct way. Below is the script (probably not written as efficently as it could be, but I'm trying) Anyway, the script is uses simple tweens for a movieclip. I would like to use the timer/setinterval function to pause the animation between tweens (Using the event listener after the tween stops to start the interval/pause) Is this the right concept or am I barking up the wrong tree.

[Code]...

View 3 Replies

ActionScript 3.0 :: Create A Countdown Timer Event When There's A 3 Minute Delay/pause In Use?

Nov 11, 2009

at the tail end of my Flash cs4, actionscript 3.0 college project and want to incorporate a countdown Timer Event when there is a 3 minute delay of usage in the flash movie (interactive).Below is what I understand and want to accomplish.Is it correct to place the actionscript code in the actions layer of the 1st frame within the 1st scene?And will it be recognized throughout all the scenes within the flash movie?1. Have the flash movie recognize a delay of usage (no clicking) after 3 minutes to start a countdown Timer Event.??Where would I add code to the timer to fire every 3 minutes during a delay of usage?

import flash.utils.Timer;
import flash.events.TimerEvent;
var count:Number = 11;

[code].....

View 1 Replies

ActionScript 2.0 :: Pause Sound In FMX?

Jan 12, 2004

I have read i trust that I can find the help I need, as many of the members seem very knowledgeable about flash.my problem pertains to Flash MX and pausing .mp3 files I have loaded externally.

View 4 Replies

ActionScript 2.0 :: Pause Button For Many Sound?

May 21, 2010

i am having a problem in creating a plause, play button.The problem now is the button just can pause 1 sound.i have many sound at timeline and it will play 1 by 1.

This is wat i have do at the 1rst but it cant pause all the sound. i try to remove mySound.attachSound("tomato");but it wont work also. the another problem is if i click the play button for 2 times, it will got 2 sound play together.

mySound = new Sound();
mySound.attachSound("sound1");
mySound.start(0,99);

[code]....

View 14 Replies

ActionScript 3.0 :: Pause Sound In External SWF

Oct 11, 2010

I have created a Flash container movie (mainContainer.swf) that cycles through an array loading in several external swf files (animation1.swf, animation2.swf, animation3.swf, etc.). Once the user clicks the next button, the next swf is loaded, and so on...

What I need to be able to do, is to control the sound of the external swf files from the main container. Specifically, I need to be able to pause and play/resume the sound of the external swfs, but not quite sure how to access the external swf's soundChannel from the main container swf. My client recently wanted to add in a "pause" feature, and while I have been able to pause the external swf's animation, I cannot target the external swf's sound - it just continues playing while external animation is paused.

I can successfully pause/resume the sound (song.mp3) if the soundChannel is defined from within the same swf (using code below); however, I cannot seem to figure out how to communicate between the parent and child swf, if the parent is requesting the pause action, and the child swf is the one that loads in the song.

[Code]...

View 4 Replies

ActionScript 3.0 :: Pause And/or Mute A Sound?

Sep 2, 2008

i'm trying to pause and/or mute a sound, with little success.i've found out that something like 'sound.play(pausePosition)' might fail on sound-clips with low sampling-rate.however when i try to mute a sound with a 48000Khz sampling rate it simply won't work.

i've tried both -

soundChannel.SoundTransform.volume = 0
- and -
SoundMixer.SoundTransform.volume = 0

however both won't mute the sound and when traced return 1.

View 1 Replies

Professional :: How To Pause A Sound Clip

Jul 26, 2010

I have the basics down to create a play and stop button and add the actionscript 3 code to play and stop, and this works good, but I really want to be able to pause the clip and resume from the paused spot.Here is the basics...two layers..."AS3" for the scripts, "Buttons" for the buttons.two buttons named "playbtn" and "stopbtn".One frame for eachIn the Scripts frame, the code is:

var loadSnd:URLRequest = new URLRequest("bim1.mp3");var thisSnd:Sound = new Sound();thisSnd.load(loadSnd);
var sndTrans:SoundChannel = new SoundChannel();

[code].....

View 2 Replies

ActionScript 2.0 :: Pause A Sound While It's Streaming?

Jun 3, 2010

So I've been "doing research" for a couple of days now, found nothing on this subject, and let me get this straight:

Is there no way to pause/resume a sound whilst it's being streamed?

Because loadSound() will start playing it immediately; attachSound() can't stream; and start() will simply not work till it's fully downloaded, or am I missing some essential brain cells here?[code]...

View 2 Replies

ActionScript 2.0 :: Looping Sound AFTER Pause?

Jan 15, 2007

sound loops wonderfully when I just let it play. And, my sound would loop perfectly if I set up just start and stop buttons to control it.

But, here's the problem. I want the "stop" button to function as a "pause" button rather than a "stop" button.

[Code]...

So now, it pauses and plays perfectly, the problem is that when it gets to the end of the sound file, it loops back to the last point it was "un-paused" rather than looping back to the beginning of the sound file. Make sense? Has anyone come across this before? How can I get it to loop back to the beginning no matter when it was paused?

View 4 Replies

ActionScript 3.0 :: Pause Sound In External SWF?

Oct 7, 2010

I have created a Flash container that cycles through an array loading in several external swf files. What I need to be able to do, is to control the sound of the external swfs from the main container. I would like to be able to pause and play/resume the sound of the external swfs, but not quite sure how to accomplish this, as I am newly migrating to AS3. Some of the sound is embedded in the external files, while others load it in via AS.

I was able to successfully pause/resume the animation of the external files, but cannot get the sound to pause - it just continues playing while the animation is stopped.

How can I pause and resume the sound of my external swfs from my main container?

View 6 Replies

ActionScript 3.0 :: Play / Pause Sound Channel?

Jan 8, 2010

The pause button in my MP3 player resets the track to the beginning, there is something wrong with my sound channel because when i trace the position it is always zero.[code]...

View 1 Replies

ActionScript 2.0 :: F5 Pause / Resume Sound While It's Streaming In AS2?

Jun 11, 2010

Is there a way to resume a streaming sound once it's been paused and whilst it's being preloaded in AS2?The issue being that start() won't work till the song is fully downloaded, loadSound() is only called initially and attachSound() can't stream.So first the sound is initiated with loadSound(), then I make it "pause" with stop() and what do I use for resuming? loadSound() with re-initiate it and start() won't work till the sound is fully preloaded, what the hell??Is there any other way of streaming external MP3s in AS2? Will simply switching to AS3 solve this?

View 1 Replies







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