ActionScript 2.0 :: Pausing A Mp3 Sound
Feb 29, 2004i am making a music player in flashmx but i don't know how to pause the mp3.
View 4 Repliesi am making a music player in flashmx but i don't know how to pause the mp3.
View 4 Repliesmy problem pertains to Flash MX and pausing .mp3 files I have loaded externally. I have searched this forum, but every useful thread i found references [URL] but that page gives me and http 500 internal server error... ie the site is down.
but my problem is that I need to know if there is a reletively simple (or actually any at all) way to pause a song through a button that i have externally loaded... this is my code so far:
[AS]
Song = new array("tonight.mp3", "when in doubt.mp3", "hey now.mp3");
bgSound = new Sound(this);
bgSound.loadSound(Song[Math.floor(Math.random()*3)], true);
bgSound.start();
[code]...
It looks a little complicated because i have a volume slider in there, as well as loading songs randomly... but what i need to know is how to get the stopB button to pause the song... and the playB button to resume it... right now stopB just stops the song... and playB loads a new one randomly.
Can you pause both animation and sound? I know you can do
on(release){
stop();
stopAllSounds();
}
but you can't start the sounds again after that at the place they were at, like a soundtrack. What is the actionscript (if it exists) for a pause and play buttons that also pause and play the sounds?Imported movies pause sound with stop();, do i have to export an swf with like just the soundfile and put that in? Cause i think that would work but sounds like too much trouble.
I'm trying to pause and resume play a background sound loop and tweens with the same button
The animation pauses and resumes fine. But when the music resumes, it gets cut-off early, and it doesn't loop anymore.
The code is as follows:
[code]...
So my program starts playing and my background music starts to play and loops...
Actionscript Code:
mySoundChannel = mySound.play(0, int.MAX_VALUE);
but i'd like to be able to pause the background music and then continue looping. this is what i'm doing now after i've stopped the song and acquired it's current position, and am ready to play again...
Actionscript Code:
mySoundChannel = mySound.play(resumePosition, int.MAX_VALUE);
problem is that when it loops, it loops back to the resumePosition (as expected since that's when we told it to start playing from). so how to i resume AND loop starting over at the beginning of the song?
I haven't found this one yet, plenty about pausing sound, but I have sound loaded into a movie clip so:
Code:
Intro1 = new Sound (soundLoader);
Intro1.loadSound("SndIntro1.mp3", true);
I'd like to get a pause button to stop the animation, get the position of the sound, stop it also, and then clicking the play button will start the animation, and also the sound from the same position it was stopped (in other words resume the sound). Here's my script for the pause button, it's stopping the animation, but still not the sound:
Code:
on (release) {
pauseTime = Intro1_sound.position;
Intro1_sound.stop();
stop();
}
I am making a set of image galleries which will have looping background music. What are your opinions about the recommended method to bring music in? I am happy with the attachSound and loadSound methods, but wondered whether attaching a soundtrack.swf using loadMovieNum would be better. If so, I only know how to stop and start the music, not pause it and restart where it left off, which is important if I add a narration. Sound Objects seem more versatile because they let you use "position/1000", but from what I have found on the forums I have searched through, I may have to load the swf into a Movieclip or perhaps use _level somewhow?
Here is the code, which works well, but does not "pause" the music, it just stops and starts at the beginning. Code is in the root timeline of my soundControls_mc (play/pause button).
[Flash 8 - AS2]
loadMovieNum("includes/number10.swf", 100);
soundOn = true;
this.onRelease = function() {
if (soundOn == true) {
unloadMovieNum(100);
[Code] .....
I'm having problems with pausing and resuming a background sound on one button. I tried some examples from kennybellew.com tutorials, but it just wont work for me.I have done some button work before (toggling, turning layers on/off etc.), i just never had to deal with sound.
View 9 RepliesI have an issue with an animation/movie thingy i am making
When the user for example, Switches a tab in firefox or something. The sound on the video will continue to play, but the animation will pause. Leading the animation to become out of sync with the sound.
Is there a way to make the animation continue playing even if the tab has been changed??
I wanted to have this Zombie Penguin enemy use a walk sound (it would be odd if he moved and was silent) but because it is initializing the whole world, simply coding the sound into his animation state won't work because it will play the sound for every existing Zombie Penguin in the world, not just the one on the screen.
Now I've tried to get around this problem by using a SoundManager class [URL] to load and play/pause the sound when necessary. I've got this working by placing a movieclip above the world and hittesting everything and when it finds a Zombie Penguin activates the SFX. If it finds the enemy and you leave the room or kill the enemy (basically any way it is removed from the screen) it will pause the sound (not stop) and then unpause if you go back/find another instance of that enemy.
The problem is, though, that if I STUN the enemy (not kill it) it plays it's dizzy animation (which consists of hit sitting down with stars spinning around it's head) the walking SFX continues to play as the enemy is still on the screen.Now in the Zombie Penguins .as file it has a boolean that for being stunned or not (bStunned), and a function (public function getZPStun():Boolean -- returns bStunned). this bStunned boolean is set to a default of false.I figure that I just have to reference that somewhere in the following code, but I'm not sure where. The Zombie Penguin's .as is ZPEnemy, so I'm calling it like so:
ZPEnemy.getInstance().getZPStun()
I've tried calling it as part of an if statement a in a number of placesin hopes that calling it will relate the current state of the bStunned boolean, but I can't seem to get it to work.
Code:
var bNotPenguin = true;
for(var i = 0; i<this.numChildren; i++) //** Sound Manager Coding (May 15)
{
[code]....
I am triggering short sounds dynamically from the library for a game (Specifically Air for Android). When the user clicks a button the sound can take up to 600ms to actually play. I have set it for any silence before the actual sound by calling the sound like so:
[Code]...
All return the same results. I know there are threads here that talk about this but none have offered a real solution that I can find. Is there no way to cache the sound or store it in a buffer?
I have created a simple interactive tutorial with buttons that open specific scenes (sections) in the tutorial using gotoAndPlay(). These scenes are initially "duplicates" of each other, except for some of the objects in the scene. Everything was doing ok but when I reached my 12th scene, things became messed up. Initially, when I added this last scene (say, SCENE2, with the same contents as the one copied from SCENE1) and published it, the SWF was behaving correctly. But when I just extended the timeframe to accomodate a longer audio, this scene keeps on pausing on the last frame for some reason. I'm assuming that if there are no animations and just audio playing, it would still not pause. I copied another scene, say SCENE3, also from SCENE1, that would play after SCENE 2. When I click on the button to play SCENE3, it just goes to the last frame of SCENE2 and does not play, eventhough the script for that button is just gotoAndPlay("SCENE3",1).
View 1 RepliesI have an external .flv and I simply need to be able to pause it with a frame action and start it back up with another frame action.I found some references to "flvStream.play" through google but I haven't been able to properly implement it.
View 3 RepliesI've been making a short movie. It contains some tweens (both shape and motion). I want the movie to automaticly pause at a specific moment (which bisects multiple tweens) and for a button to appear to contine the movie
View 5 RepliesI am having a problem restarting a function I have stopped using delete this.onEnterFrame a panel scrolls on the x based on mouse position. here is the code
panel.onRollOver = panelOver;
function panelOver() {
this.onEnterFrame = scrollPanel;[code]....
then on a button click I want the scrolling to stop and be able to be restarted on click from within a child movieclip.
Is there a way of pausing a mc timeline? so when u return its at the same stage where it was paused it ?
View 1 Replieshow to get an animation to pause at a desired frame after a click rather than just stopping it at that exact frame or putting a stop action at the desired frame. My goal is to have a movie sequence play continuesly and when a user so desires he/she can click and stop the movie, but rather than stop it while it is in transition at that exact frame, the movie should continue to a point where it is logical for the movie to stop.(example: the movie is at frame 2 when the user clicks, but instead of stopping at frame 2 it continues to frame 10, and then stops) Then on another click the movie will continue through it's sequence as it was before. I would like to use a MC, onClipEvent to handle the script in Flash MX.
View 4 Repliesi have a modified xml slideshow i previously tried to clear the intervals to pause the show to no avail.
Code:
var id, current;
var k = 0, p = 0;
var slide = 1;
[code]....
ok so I have the webcam in my flash movie,so you see your cam in the frame..but i was wondering if there was a code to pause the stream so you can a 'snapshot' without having to save anywhere or anything too complicated.. just literally pausing then un-pausing
View 3 RepliesI'm new to actionscript and am trying to have a simple three pictures coming in one at a time then some text rotation around them.I have the following code for the pictures coming in from the left but I need to somehow pause between each one as at the moment they all come in together:
import mx.transitions.Tween;
import mx.transitions.easing.*;
var xPosT:Tween = new Tween(runner, "_x", Bounce.easeOut, -700,-175, 2, true);
[code]......
Is there a way of pausing a mc timeline? so when u return its at the same stage where it was paused it ?
View 1 RepliesI'm attaching an MC to the timeline and within that attached MC is a LoadVars.sendAndLoad command. This works flawlessly when I have a few variables but becomes horribly bogged down when I have to send (and receive) lots of data. It actually freezes my swf until all the data is loaded, then switches windows <minimizes itself in Win XP> after it's all done loading.So I figure I need a way for the original attach movie to finish loading, before I send the PHP commands...
View 1 RepliesI am creating I guess what you could call a swf library. It's a bunch of different interactive swfs all packaged up into a main swf that I can embed on my page. Each swf contains flv's that play. They all work great in my main swf and individually, that's not my problem.Everything is working great but I have a menu that pops up to change between different episodes and it works great.BUTWhat I'm looking to do is when you click on the menu button and the menu pops up over the externally loaded swf, I want the externally loaded swf to pause. Then when you close the menu I want it to un pause. It looks really tacky when the menu pops up and the flv's in the externally loaded swfs keep running. I knew how to pause them in as2 but only from the swf they were actually in.
This is my code (this all works) I just can't figure out code to add that will pause everything when the menu pops up ...box is what I named an empty box on stagetop_btn is the button that launches the menu
var myLoader:Loader = new Loader();
var myURL:URLRequest = new URLRequest("NewHarbison2.swf");
myLoader.load(myURL);
[code]....
I'm working on a script and I've run into a coder's writing block so-to-speak. I have an array of twenty object (with attributes). I want to loop through the array and for each object, update some text fields, create a tween, pause, and create another tween (i.e. fade in / fade out). I tried working with the timer class but the for loop, as expected, keeps on rollin' after the function has been called by the listener.
View 10 RepliesPausing, stopping and playing movieClip (MC) children. I am making SWFs that an interface will load and control (pause, re-start, stop, etc.). Then the interface is paused, the main MC will pause but not it's child MCs. I didn't write the interface, I am just supplying SWFs that are loading into the interface. The developer of the interface willn't allow me to use animated MCs in my SWFs since he can't control them with the interface. So all my animation need to be on the main time line, which is no optimal to say the lease.Can I provide him with some code to allow him to stop the child MCs or is there an Event Listener I could include in the child MCs that would pause, stop, restart, etc when the main MC changes?I currently do not have a fix at this time and since all my animations are on the main timeline, is there a way to select multiple objects (on difference layers) and move and resize them across multiple keyframes?
View 1 RepliesI created a scene with my splash, etc. the last frame loads a text menu. I would like the links for each text menu item to start a new scene for the content of that menu item. Then when it is over, have a return button to go back to my scene with the menu items. I created the scenes, but when ever I play the movie, the scenes keep going one right after the other.
View 3 RepliesI want to be able to pause a movies timeline for 3 seconds,then have it start playing again.
View 3 RepliesI've been making a short movie. It contains some tweens (both shape and motion). I want the movie to automaticly pause at a specific moment (which bisects multiple tweens) and for a button to appear to contine the movie. I am completly new to flash and will have to have everything spoon fed to me.
View 1 RepliesRight now I am using this code to load an external mp3 file into my website:
var url:String = "my file";var urlRequest:URLRequest = new URLRequest(url);var sound:Sound = new Sound();sound.load(urlRequest);sound.play();
I am wondering if it is possible to add playback buttons (play, pause, stop) which control this external mp3 file from my site. And what code I would use to do that.
I am new to Flash and am still trying to come to grips with AS3. I want to pause an animation twice in the same timeline. I have applied the code given in the adobe article 'Using ActionScript to pause and loop the timeline in Flash' [URL].
this.stop();
var timelinePause:Timer = new Timer(2000, 1);
timelinePause.addEventListener(TimerEvent.TIMER, timerHandler);
timelinePause.start();function timerHandler(evt:Object):void {
this.play();
}
This works well when used once in the timeline but I get the following errors when applying it twice
1151: A conflict exists with definition timelinePause in namespace internal.
1021: Duplicate function definition.
Warning: 3596: Duplicate variable definition.
What I need to change to make it work twice.