473,386 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How can I play an animation when audio is streaming?

57
I have a streaming audio player that works, but I want to add a movie clip that plays when the audio is actually streaming and stops when the audio stops. So far, my actionscript plays the animation right away, when I push the play button, even before the audio is actually playing.

Here's my code:
Expand|Select|Wrap|Line Numbers
  1. function getSound(url:String) {
  2.     sound.stop();
  3.     delete sound;
  4.     sound = new Sound();
  5.     sound.loadSound(url, true);
  6. }
  7.  
  8. function audioStop() {
  9.     sound.stop();
  10.     $marker = sound.position/1000;
  11.     $state = false;
  12.     _root.animation.gotoAndStop(1);
  13. }
  14.  
  15. function audioPlay() {
  16.     sound.start($marker);
  17.     $state = true;
  18.     _root.animation.play();
  19. }
  20.  
  21. function checkState() {
  22.     if ($state == true) {
  23.         audioStop();
  24.     }
  25.     else {
  26.         audioPlay();
  27.     }
  28. }
  29.  
  30. getSound("urlofaudio.mp3");
  31. sound.stop();
  32. var $state = false;
  33. var $marker = 0;
  34. trigger_btn.onRelease = checkState;
Anyway, everything like this that I get stuck on, I'm sure it's something simple that I've overlooked. I'm pretty sure I just need to tweak something in the audioPlay() function.

Any help would be appreciated.

Thanks in advance!
Oct 18 '10 #1
0 1239

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: NL | last post by:
Hi, Does anybody know how to turn off the animation Windows does with a window as it's minimized/maximized to the taskbar? I have an app which, when minimized, syncs to any other open...
0
by: Casey Brown | last post by:
Hi, I have written software that creates charts. These charts can be saved as images and imported into various applications (e.g. Excel). What I would like to create now is a way to animate...
0
by: Dony Isnandi | last post by:
Hi all, I want to read and play a Vox audio from a web based application. Any help would be appreciated. tia Dony Isnandi
3
by: Mizu | last post by:
Hi, I have a problem,I would like make a audio streamer for a web, but I don't know,whitsh namespaces should I use.Also I need make web service,web aplication or desktop aplication. When somebody...
3
by: skt | last post by:
Hi Can anyone tell me how I can stream audio input from a microphone input in C/C++? I would prefer plain C/C++, rather than DirectX/Windows programming, though those would be fine too. Also, how...
1
by: fai210 | last post by:
I need to write a program about audio streaming in java. Are there any good sites that contain relevant tutorial and have some good examples for reference? Thank you.
8
by: pankhudi | last post by:
Hi everyone... I have to do a project work related on online audio system in Java...I have done the server-client prog(socket prog) n playing audio files..But how to stream my audio file from one PC...
3
by: pankhudi | last post by:
I have written the code(in short) as below on the server side and client side import sun.audio.*; import java.io.*; import java.net.*; class Server2 {
1
by: npm | last post by:
I know how to stream audio from within an .swf as well from an external mp3, but does anyone know if Flash is able to stream OGG? The filename for the stream is usually something like,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.