473,800 Members | 2,495 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

auto stream MP3 into flash from external file (not via XML)

elamberdor
39 New Member
Hi All!
I've got a streaming MP3 from a folder on the site to load on PLAY/STOP buttons, and volume slide okay, but I need it to AUTO PLAY when on a frame of the movie. It's about 2mb.

(just so when you get into the site the background music plays auomatically, then the user can adjust volume or stop if they need to)

Any ideas?

(Here's my actionscript) How can I add to this script to auto play the file as well?
Expand|Select|Wrap|Line Numbers
  1. var mySound:Sound = new Sound();
  2. mySound.loadSound("mySound.mp3", true);
  3. mySound.stop();
  4. btnStop.onRelease = function():Void  {
  5.     mySound.stop();
  6. };
  7. btnPlay.onRelease = function():Void  {
  8.     mySound.start();
  9. };
  10. var nVolCheck:Number;
  11. mcVolSlider.volBall.onPress = function():Void  {
  12.     this.startDrag(false, 0, 0, 400, 0);
  13.     nVolCheck = setInterval(updateVolume, 100);
  14. };
  15. mcVolSlider.volBall.onRelease = function():Void  {
  16.     this.stopDrag();
  17.     clearInterval(nVolCheck);
  18. };
  19. function updateVolume():Void {
  20.     var vol:Number = (mcVolSlider.volBall._x)/4;
  21.     mySound.setVolume(vol);
  22.     mcVolSlider.volBall.volText.text = vol;
  23. }
  24.  
any ideas at all would be helpful!
Thanks in advance guys!

=)
Aug 30 '07 #1
4 3180
elamberdor
39 New Member
Hi All,
no ideas at all? :)
Aug 31 '07 #2
xNephilimx
213 Recognized Expert New Member
Hi, elamberdor!
The script that you posted is for the background music, isn't it?
If you want the code to start playing as soon as it finished loading you can do it but setting the start method inside it's onload. Like this:

Expand|Select|Wrap|Line Numbers
  1. mySound.onLoad = function(success) {
  2.      if(success) {
  3.           this.start();
  4.      }
  5. }
  6.  
In any case, your sound is streaming, so you can just do mySound.start() and it will start playing what has already loaded.

Please post back and tell me if this answers your question.

Kind regards,
The_Nephilim

PD: Sorry if I missed any "k". I'm not in my house now, and this keyboard has a crummy k.

Hi All!
I've got a streaming MP3 from a folder on the site to load on PLAY/STOP buttons, and volume slide okay, but I need it to AUTO PLAY when on a frame of the movie. It's about 2mb.

(just so when you get into the site the background music plays auomatically, then the user can adjust volume or stop if they need to)

Any ideas?

(Here's my actionscript) How can I add to this script to auto play the file as well?
Expand|Select|Wrap|Line Numbers
  1. var mySound:Sound = new Sound();
  2. mySound.loadSound("mySound.mp3", true);
  3. mySound.stop();
  4. btnStop.onRelease = function():Void  {
  5.     mySound.stop();
  6. };
  7. btnPlay.onRelease = function():Void  {
  8.     mySound.start();
  9. };
  10. var nVolCheck:Number;
  11. mcVolSlider.volBall.onPress = function():Void  {
  12.     this.startDrag(false, 0, 0, 400, 0);
  13.     nVolCheck = setInterval(updateVolume, 100);
  14. };
  15. mcVolSlider.volBall.onRelease = function():Void  {
  16.     this.stopDrag();
  17.     clearInterval(nVolCheck);
  18. };
  19. function updateVolume():Void {
  20.     var vol:Number = (mcVolSlider.volBall._x)/4;
  21.     mySound.setVolume(vol);
  22.     mcVolSlider.volBall.volText.text = vol;
  23. }
  24.  
any ideas at all would be helpful!
Thanks in advance guys!

=)
Aug 31 '07 #3
elamberdor
39 New Member
Hiya The_Nephilim!!

Your "k's" are just fine! As so is the code! :)
Definitely background music, I placed this in after the load.sound function... and it worked perfectly!

Thanks heaps and as always very helpful!
=)


Hi, elamberdor!
The script that you posted is for the background music, isn't it?
If you want the code to start playing as soon as it finished loading you can do it but setting the start method inside it's onload. Like this:

Expand|Select|Wrap|Line Numbers
  1. mySound.onLoad = function(success) {
  2.      if(success) {
  3.           this.start();
  4.      }
  5. }
  6.  
Aug 31 '07 #4
xNephilimx
213 Recognized Expert New Member
You're welcome!
Glad you got it to work now.

Best regards,
The_Nephilim

Hiya The_Nephilim!!

Your "k's" are just fine! As so is the code! :)
Definitely background music, I placed this in after the load.sound function... and it worked perfectly!

Thanks heaps and as always very helpful!
=)
Aug 31 '07 #5

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

Similar topics

2
2609
by: Manlio Perillo | last post by:
Hi. This post follows "does python have useless destructors". I'm not an expert, so I hope what I will write is meaningfull and clear. Actually in Python there is no possibility to write code that follows C++ RAII pattern. Of course Python objects are not statics like in C++, but in C++ the auto_ptr class is used for enforcing this pattern for dynamical
0
2044
by: Uma Vivek | last post by:
Hi, I have a problem with Flash remoting via .NET . I seem to have all the code right, but flash does not seem to display the data at all. Here's is what Ive done so far... (1) Ive installed Flash Remoting MX, and copied over the contents of wwwroot\flashremoting\bin into my web application's folder\bin.
3
5576
by: Mike | last post by:
I have a simple flash file that plays within a webform of an asp.net app. When running from the server the flash file works fine. But when I run it from my localhost the flash file simply doesn't play. I have Flash installed on my localhost, and I'm not sure why its not working. Is there a setting somewhere in IIS or the computer's Extensions of my localhost which may be preventing it from playing? Before posting my code which...
5
1985
by: JJ | last post by:
Although this question involves Flash, I suspect the actual issue is an asp one.. I am trying to open the web.sitemap file in an .swf file enbedded in an asp page (I'm working in VS 2005). I get an error in Flash when it trys to open this file using standard Flash commands. However when I change the file name and command to 'Web.xml' it works. (it also works if I don't change the name, but run the swf in flash player and not via the...
1
2742
by: gescom | last post by:
I'm trying to build an image gallery in Flash that extracts data from two external XML files using Actionscript. Currently I have one fully functional gallery that I'm satisfied with and would basically like to duplicate it in design, but use another XML file for the images, and have both galleries in the same scene. The tricky part is that I would like the second XML to essentially react to the first XML. For instance, if an image is...
8
5913
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web clients (Internet Explorer). My flash content was originally brought in via the “flash satay” method, but I have since used some server-side magic do deliver one <objecttag
1
4207
by: ramvenkat | last post by:
hi is it possible to save a external file through flash application in a particular folder specified in the flash application? means 1)would like to specify a folder while saving a particular external file through flash 2)need to take the saved file again through the same flash file..
2
4560
AutumnsDecay
by: AutumnsDecay | last post by:
Hey. New problem. Ugh... As it turns out Flash will not load an XML file located elsewhere (some other websites, network, etc..). It will only load local XML. This causes a problem for me. My code requires external XML as it is generated by a weather service. Is there a way (using AS2) to allow for loading of external XML instead of having it hosted locally?
0
9690
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9551
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10504
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.