Random mp3 playback

I have main movie that controls a loader component a series
of buttons that load different movies into the loader component
when the appropriate button is released. I also have a random
background song that plays when the main movie loads. Here's that
code:
var myArr:Array = new Array();
myArr[0] = "bgAudio/song01.mp3";
myArr[1] = "bgAudio/song02.mp3";
myArr[2] = "bgAudio/song03.mp3";
myArr[3] = "bgAudio/song04.mp3";
myArr[4] = "bgAudio/song05.mp3";
myArr[5] = "bgAudio/song06.mp3";
myArr[6] = "bgAudio/song08.mp3";
myArr[7] = "bgAudio/song09.mp3";
myArr[8] = "bgAudio/song10.mp3";
var myVar:String = myArr[random(myArr.length)];
var mySound:Sound = new Sound();
mySound.loadSound(myVar,false);
mySound.onLoad = function(success) {
if (success) {
this.start();
I would like mySound to randomly change with every onRelease
event for the buttons. I thought I could suff the above code in a
function and call the function from each button but that didn't
work so I guess now I'm stuck.
JT

Alright I've done figured it out Hope this helps someone else
out there;
Leave the above code in tact at the top of your actionscript
it loads and plays the sound the first time the movie is loaded.
Place the following code below;
function playNewSong() {
mySound.stop();
var myVar:String = myArr[random(myArr.length)];
mySound.loadSound(myVar,false);
mySound.onLoad = function(success) {
if (success) {
this.start();
mySound.setVolume(25);
It's basically the same as the 8 lines of code above less the
var mySound:Sound = newSound(); if you leave this in you'll wind up
with multiple instances of the mySound sound object playing at the
same time.
The other change is at the top of the function
mySound.stop(); making sure that the currently loaded sounded is
stopped before loading a new one.
add the call to the function playNewSong() to your button
onEvent and away you go.

Similar Messages

  • Rhythmbox -- which package needs to be installed for mp3 playback

    Hello,
    A quick question here:
    Which package needs to be installed for mp3 playback in Rhythmbox?
    ta, t.

    Thanks, that seemed to be the right plugin.
    ta, t.

  • Random video playback

    Hi,
    I have posted this request for the past couple of years. I am amazed that some simple program cannot do the following -
    Play video clips in random order. That's it. That is all it has to do.
    iTunes will allow you to play a list of videos but only in order from top to bottom. If you try shuffle it freezes. I've talked to Apple techs about this too and other third party vendors like Boinx. Random video playbacks are not featured in any program out there for all I know.
    It would be nice too if the program could equalize the sound level too from video to video - that's all it would have to do.
    Is there a reason why this is so hard to do? I have a mac mini attached to a Apple Cinema and I like to show video clips from Vimeo and other places but not always in the same stale order from top to bottom. Yes I can drag and re-order the playlist, but sure would be nice to have it all done randomly and to keep a constant volume level from video to video.
    thanks - if you have any ideas or can help
    I think a random video playback feature would be neat in iTunes or Front Row or am I the only guy that digs this? I could be since third party developers are not harkening to this calling.

    I've never had any issue using the shuffle feature in iTunes to play videos in random order. You might try creating another user account to see if it is a permission issue. If it's not, you might want to reload the latest version of iTunes on your computer.

  • Random video playback program

    Hi,
    I have posted this request for the past couple of years. I am amazed that some simple program cannot do the following -
    Play video clips in random order. That's it. That is all it has to do.
    I am only sending this post to you since you are a top user here and seem to know a lot about this stuf, and I was reading this discussion on video mgt programs.
    iTunes will allow you to play a list of videos but only in order from top to bottom. If you try shuffle it freezes. I've talked to Apple techs about this too and other third party vendors like Boinx. Random video playbacks are not featured in any program out there for all I know.
    It would be nice too if the program could equalize the sound level too from video to video - that's all it would have to do.
    Is there a reason why this is so hard to do? I have a mac mini attached to a Apple Cinema and I like to show video clips from Vimeo and other places but not always in the same stale order from top to bottom. Yes I can drag and re-order the playlist, but sure would be nice to have it all done randomly and to keep a constant volume level from video to video.
    thanks - if you have any ideas or can help

    Thanks Nick,
    Have you tried using VLC and it plays videos randomly ?
    I am trying to register with the VLC forum and I can't get on.
    It is not taking my registration.

  • Player 10 - Slow and Distorted MP3 Playback.

    I began experiencing this problem once I download Flash
    Player 10. The mp3 playback is slow and sounds very distorted.
    This only seems to occur with mp3s at a 48k sample rate. Mp3s
    at a sample rate of 44.1k sound normal. Is there a way to fix this
    without converting the sample rate? Is Adobe working on a solution?
    Thank you.

    I'm getting the same thing. Are all of you on Apple platform? It seems to be the only place this is showing up.
    Macbook Pro - OSX 10.5.6
    When I uninstall flash player and reinstall 9 it works fine. On another not when using CS4 at work the same thing happens locally when I test the movies.
    It's sounds like music on nitrous in hell. .. . .

  • E55 - improve sound on mp3 playback?

    mp3 playback on my E55 is dissappointing; you need to add Bass enhancement just to get a flat frequency response and the music lacks detail even on simplet tracks.
    I know it's not a dedicated mp3 player/'comes with music'/Walkman phone but how can I improve music playback?
    - Is eACC format easier on the processor?
    - Is there a 3rd party mp3/ACC player for E55 that sounds better?

    I should have explained;
    - Yes, I'm using same pair of headphones to compare same tracks played back on E55 and laptop. Laptop is satisfactory and I'm used to what it 'sounds' like, E55 mp3 player is poor.
    - Source is mp3 so ACC/eACC would require an additional conversion (rather than ripping CDs to ACC in the first place).
    Seperate headphone amp is nice idea, but my sound quality expectations aren't quite that high for a phone. Would only bother with headphone amp for CD line output or similar cheers.
    Further testing;
    - Internet Radio on E55 is quite acceptable and dosn't need any bass re-infocement. I conclude the problem is with the mp3 playing software on E55 or the source mp3 - not the S60 OS or E55 hardware.
    - Playing further albums on proved that BOTH the laptop and E55 did justice other mp3 and WMAs including Opera, Rock and Dance.
    Conclusion: "The Haçienda - Acid House Classics" mp3 album is a bit quite and not a great source. But the E55 still needs bass turned on for the music player (but not Internet Radio!) so could be solved with a software update.
    Other sources sound as good as you could expect on the E55: rubbish in ribbish out.
    Now to see if converting from mp3/WMA to ACC/eACC can actually improve the sound. I used to think it impossible to improve a signal with additional processing, but my Sony Hard Disk TV Recorder actually plays back better than the original(!) so maybe converting to ACC will to.

  • MP3 Playback

    I'm having issues trying to get MP3 playback capability on my Arch x86 - Xfce4 install. I have all of the gstreamer plugins installed and my sound card is configured properly (I can listen to audio in swiftfox), but Banshee Audacious and Totem will not play MP3 files. Has anyone seen a situation like mine? I have not found one after taking some time to search these forums. Thanks in advanced for any help.

    [root@celestary wengophone-ng-svn]# pacman -Qs MP3
    local/lame 3.97-1
    An MP3 encoder and graphical frame analyzer
    local/mpg321 0.2.10-2
    A commandline mp3 player
    local/python-eyed3 0.6.12-1
    A Python module and program for processing information about mp3 files
    local/ripperx 2.7.0-1
    GTK program to rip and encode mp3 files
    Here it works perfectly. libmad and lame should be sufficient.
    OGG media plays flawlessly?
    Last edited by chaosgeisterchen (2007-06-17 21:08:14)

  • Stop Streaming MP3 Playback

    Is there an action script to stop the streaming mp3 playback
    in a proceeding frame navigated to?

    SM6601,
    > Is there an action script to stop the streaming mp3
    playback
    > in a proceeding frame navigated to?
    If that sound is initiated by ActionScript (e.g. an instance
    of the
    Sound class), the Sound.stop() method will do it. If not, you
    can always
    try the stopAllSounds() function.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

  • Palm Pre - MP3 Playback skips

    Haven't had any troubles with mp3 playback on my Palm Pre until yesterday. Every song I listen to skips intermittently.
    Post relates to: Pre p100eww (Sprint)

    I only had 2 or 3 other cards open at the time of the malfunction (gps, email, phone, and music player). Would that be enough to cause this? I understand that memory is memory, but since multitasking is the cornerstone of the device's design philosophy I think it's fair to expect 4 or so apps to all work at the same time.
    That said, I usually have something closer to 8 apps open, and that has never affected my listening experience.

  • Gstreamer mp3 playback broken

    When I tried to play some mp3's today via Clementine, gstreamer gave me "data flow error"(everything worked yesterday,lol) , and then, when I reinstalled all possible gstreamer plugins(except "ugly") mp3 playback didn't change at all, some mp3 files were played but with (:03, :06, :09 second speed) like it is jumping, no sound of course. Does anybody know how to fix it, and why is this happening?

    [root@celestary wengophone-ng-svn]# pacman -Qs MP3
    local/lame 3.97-1
    An MP3 encoder and graphical frame analyzer
    local/mpg321 0.2.10-2
    A commandline mp3 player
    local/python-eyed3 0.6.12-1
    A Python module and program for processing information about mp3 files
    local/ripperx 2.7.0-1
    GTK program to rip and encode mp3 files
    Here it works perfectly. libmad and lame should be sufficient.
    OGG media plays flawlessly?
    Last edited by chaosgeisterchen (2007-06-17 21:08:14)

  • Instantaneous MP3 playback...

    MP3 playback used to begin immediately even with very large files, but no longer does. What am I missing? It seems there may be some type of "helper" file for other browsers (read Safari, Chrome & Opera) that isn't being taken advantage of to facilitate this "starting play before the download is complete" type of thing...

    The playback time would vary based on any number of factors:
    Temperature, volume, other operations, how long the screen is on, how many times you change the volume, eq settings, if airplane mode is on or off, any calls, e-mails, push on or push off, how often to fetch mail, screen brightness, 3g on or off, wi-fi on or off, location service on or off,etc.
    The 24 hours is based on a specific situation and is not likely to be reproduced with normal use.
    Just use it and see what you get.

  • Mp3 playback in applets?

    can an applet grab a random mp3 from the server at runtime and play it? does anyone have any examples of this? particularly, how does one transfer the mp3 from the server to the applet, and then how does one play it?
    thanks!

    You probably need to either install the correct gstreamer plugins or phonon-xine.  I don't remember which set of gstreamer plugins has MP3 support, but installing all of them (gst-plugins-{base,good,bad,ugly}) should work.

  • Mp3 playback battery life /w headphones

    Does anyone know if the mp3 playback time changes if your using a set of headphones, or is the 24 hours assuming you are using headphones?

    The playback time would vary based on any number of factors:
    Temperature, volume, other operations, how long the screen is on, how many times you change the volume, eq settings, if airplane mode is on or off, any calls, e-mails, push on or push off, how often to fetch mail, screen brightness, 3g on or off, wi-fi on or off, location service on or off,etc.
    The 24 hours is based on a specific situation and is not likely to be reproduced with normal use.
    Just use it and see what you get.

  • MP3 playback cutouts, Firefox plug-in

    I've got Firefox 3.5, with QuickTime selected as the MP3 playback plugin. When I click on an MP3 link targeted at a dedicated browser window, Quicktime comes up to play it back. Unless I keep that window in the foreground, and keep sending it events (e.g., hovering the mouse cursor over it and moving it around), the playback audio cuts out. Quicktime's progress indicator proceeds, but there's no audio unless I move the cursor over the window again.
    This happens on TWO different machines (including a MacBook Pro with Windows XP under BootCamp, and a Dell Inspiron 530 with Windows Vista).
    Is this a known bug? Are there any solutions other than installing an MP3 playback plugin other than Quicktime?

    So, after 2 weeks without any response, how do I report this as a bug, and somehow get Apple to look into this?

  • Random music playback of iTunes doesn't seem so random.

    Once an artist is played it's almost certain that artist will be played 1 or 2 more times in the next 10-15 songs.  I have several hundred artists on my playlist and over 3K songs, so statistically not right.  Is there some setting or option that I have that would influence this?

    Hi,
    We could argue long time on this one.  You cannot determine the randomness based on playback statistic unless you are performing significant ammount of trial.
    Also, your question was about the odds of having a second song from a same artist within a given period.  Therefore, you will have to take into account the number of song you actually have for each artist and going this way, you are less and less talking about randomness rather than listenning to a good variaty of music.
    We could argue but, at the end, there's no setting regarding shuffle mode which is your question.
    A few years ago, there was such setting to reduce the probability of having a same artist being played twice.  At that time, I recall Steve Jobs saying that Apple was trying to make the shuffle less random because user perception is not random.  Apple decide some time ago to remove this adjustment (I don't recall the iTunes version).
    Anyhow, shuffle mix your songs... I don't see the point of making statistic.

Maybe you are looking for

  • IMac Display as Monitor for PC

    I have an iMac 2.66 GHz Intel Core 2 Duo, 2 GB RAM, OS X 10.6.2 and an old Dell Pentium III 933 MHz which I would love to somehow connect together. I am considering to install Linux on my Dell and use both computers for different reasons. I wonder if

  • I can't pull music from existing playlists to create a new one with the new update.

    I can't find a way to pull music from existing playlists when I create a new one. I make new playlists everyday with my job and this makes it very time consuming for me!

  • How i can solve proble whenprinter showing ofline

    how i can solve proble whenprinter showing ofline

  • Playing movies using VLC on external display

    My Macbook Pro is connected to my TV through the DVI port. There is a side-by-side arrangement, not mirror displays. Everything is working perfectly, sound and video. Sometimes I try to use VLC to play a movie on the TV screen, while I do work on my

  • Port 8080 to 80

    Hello All, I want to access my application from 80 port which currently is running on 8080. To make it run on 80, I have to change the Connector entry in server.xml from 8080 to 80. For this I need to retstart the server which I cannot as I need to h