How to play the next song

I am trying to build a simple player inside my swf file. The code is a bit messy, but it seems to work.

I m by a soundChannel for playback...

I m trying to figure out how to do that the player plays the next song after previous has reached its end.

Can I add some sort of EventListener to the soundChannel?

Thanks for the help

Fl.transitions import. *;
Fl.transitions.easing import. *;

prevBt.buttonMode = true;
playBt.buttonMode = true;
stopBt.buttonMode = true;
nextBt.buttonMode = true;
pauseBt.buttonMode = true;
pauseBt.visible = false;

var xmlLoader:URLLoader = new URLLoader;
var temasURL:URLRequest = new URLRequest ("temas.xml");

xmlLoader.addEventListener (Event.COMPLETE, xmlLoaded)
xmlLoader.load (temasURL);

var temasXML:XML = new XML();
temasXML.ignoreWhitespace = true;

function xmlLoaded(e:Event):void {}
temasXML = XML (xmlLoader.data);
var temaNum:Number = 0;
var tema:String = temasXML.tema [temaNum] .mp3.
var musica:Sound = new Sound (new URLRequest ("audio /" + tema))
var sc:SoundChannel;
var isPlaying:Boolean = false;
var pos:Number = 0;

stopBt.addEventListener (MouseEvent.CLICK, parar_musica);

function parar_musica(e:MouseEvent):void {}
SC. Stop();
isPlaying = false;
playBt.visible = true;
POS = 0;
}

playBt.addEventListener (MouseEvent.CLICK, tocar_musica);
function tocar_musica(e:MouseEvent):void {}
pauseBt.visible = true;
playBt.visible = false;
{if(!isPlaying)}

SC = musica.play (pos);
isPlaying = true;
playerTx.text = temasXML.tema [temaNum] .legenda;
}

}

pauseBt.addEventListener (MouseEvent.CLICK, pausa_musica);
function pausa_musica(e:MouseEvent):void {}

If (isPlaying) {}
pauseBt.visible = false;
playBt.visible = true;
POS = SC.position;
SC. Stop();
isPlaying = false;
}
}
nextBt.addEventListener (MouseEvent.CLICK, seguinte);
function seguinte(e:MouseEvent):void {}
SC. Stop();
temaNum += 1;
Musica = new Sound (new URLRequest ("audio /" + (temasXML.tema [temaNum] .mp3)))
SC = musica.play ();
pauseBt.visible = true;
playBt.visible = false;
isPlaying = true;
playerTx.text = temasXML.tema [temaNum] .legenda;
}
prevBt.addEventListener (MouseEvent.CLICK, anterior);
function anterior(e:MouseEvent):void {}
SC. Stop();
temaNum-= 1;
Musica = new Sound (new URLRequest ("audio /" + (temasXML.tema [temaNum] .mp3)))
SC = musica.play ();
pauseBt.visible = true;
playBt.visible = false;
isPlaying = true;
playerTx.text = temasXML.tema [temaNum] .legenda;
}
}

the sound class has a complete event, you can use:

musica.addEventListener (Event.COMPLETE, f);

function f (e: Event) {}

play next

}

Tags: Adobe Animate

Similar Questions

  • How to play the next song with the repetition of the same song over and over again

    How to play the next song with the repetition of the same song over and over again.

    In this screenshot, shot an Apple article, you can see four icons at the bottom of the screen. Look at the third argument of the right, with the two arrows going in a circle. It's the repeat function. When turned on, you can tap the icon to turn it off.

  • How can I stop repeating the same song and he can play the next song during playback of music on my iPad?

    Please help me. When playing music on my iPad continues to repeat the same song, and it will not move forward to the next song on the album. It drives me crazy, and if I hear the Wiggles song even more once I'll scream!

    Check these screen grabs.

    If the icon repeat has a 1 in it (as in the photo), then he will repeat this song, simply click the icon to cycle through the options.

    HTH,

  • HP Jet 7: How to stop the media player playing the next song

    I sing and I want a media player that does not automaticlly jump to the next song on my playlist

    I don't know if it will be what you're looking for exactly, but VLC Media Player will do what you describe.

    Once installed, go to Tools/Preferences.

    Select the Interface tab

    In the section of the Playlist, click the box for "break on the last frame of a video.

    Save

    Go to the media and add a file similar to Windows Media Player.

    Go to view and click Show playlist. Then the arrow above the playlist Display Mode, then choose detailed display.

    Start playback of the video or audio of first file (works for one).

    It is paused when the end is reached

    To move to the next video, press n for the next.

    Hit the key corresponding to the previous p.

    It will be useful.

  • iPhone 6 s plays the same song over and over again. How can I play songs on it down?

    IPhone 6 s plays the same song. I saw old post about the colors white and blue, but I can't find how to do this. When I hit shuffle just randomly he takes up a new song. What I am doing wrong?

    Hi david5311,

    If I understand your question, you have a list of songs (a playlist?) that you want to read in order, but one of your songs repeats instead.  Is this fair?

    Take a look at the resource below to get instructions on how to use the new music on your iPhone app.   If you change your display to the current playback full screen size, you can see the controls a little easier.  Make sure that repeat and shuffle functions are turned off and the songs should play in order.

    With the help of the new music app

    Play your music

    When you play a song, you see the Miniplayer at the bottom of the screen. You can continue to browse other titles to find the next perfect song.

    Or you can tap or slide up on the Miniplayer to see the display of current playback and controls. Press on the in the upper left corner or sliding down to close the now playing screen.

    Also on the playing screen, you can rewind, pause, or quickly transfer a song, control the volume and more.

    Shuffle or repeat your music

    Press on at the bottom of the playback screen to mix songs in a playlist or album. Alternatively, you can ask Siri to scramble your music.

    Type once to play entire playlist or album looped or twice to repeat a song.

    Enjoy!

  • How can I stop my songs to change to the next song before finishing (on AppleTV)?

    How can I stop my songs to change to the next song before they ended?

    I don't think that apple TV has a setting of crossfade. The music is being heard from iTunes? In iTunes, this is defined in the preferences > reading.

    TT2

  • How to play the song with .wma extension

    How to play the song with .wma extension

    If it does not DRM, use VLC. If so, no Mac OS X software can play or convert.

    (142864)

  • How do I create a pause between songs in my playlists? Manually start the next song?

    How do I create a pause between songs in my playlists?  Manually start the next song?  I use XP with WMP11

    The following freeware will allow you to add as much
    (1 to 100 seconds) pause between tracks that you need:

    (FWIW) It's always a good idea to create a system
    Restore point before installing software or updates)

    CDBurnerXP
    http://www.CDBurnerXP.se/
    (Yes, it works on XP, Vista, 7)

    CDBurnerXP to make Audio disc
    http://CDBurnerXP.se/help/audio/compileaudio

  • How to keep playing the last song played after the external card refresh

    Does anyone know how to continue to play the last song played after the update of external card? Every time when I connect and disconnect the player from the PC to update some of the songs it refresh the external memory card and then play the first song of the record. Can anyone help? Thanks in advance.

    Adding or deleting files trugger a database refresh to disconnect from the computer. This resets the file before playing. There is no way to change this.

  • Windows Media Player 12-impossible to scroll to the next song in the song playing

    Windows Media Player 12

    Hello

    I have Windows 7 on my computer, it is already installed with Windows Media Player 12, I find that when I chose a song to play, I don't, when I take another song to play, I can not scroll the next song in the song that is already running, like WMP 12, DO NOT HAVE THAT FUNCTION, to allow me to do still in the older version of WINDOWS MEDIA PLAYER 11, you can do it, I know that creating a playlist would solve this problem, but I don't want to do that, Jean-Claude, I had sometimes simply highlight a song anywhere on the playlist & scroll downwards or upwards, directly below the song playing already also, in the main selection, I can't organize my songs in order, I like to do that as well, and yet, in WMP 11, you can also do.

    Why the new version of WMP 12, did not have these features, as the older versions had, I am very disappointed in WMP 12, it is simply & boring, I can't even add color improvement for WMP 12 because there is no function for this as well.

    BRING BACK THE OLD VERSION OF WMP 11, I SAY, CAUSE OF WMP 12 SUCKS!

    Do you mean that you always want to see the playlist Now Playing music while? In WMP 12, read the list is hidden by default. In library mode, click reading (top) to bring him back. In now playing mode, right-click on a blank area and select list . Tim Baets
    http://www.BM-productions.TK

  • How to stop the same song playing over and over again

    as long as he's 58, I tend to want to listen to entire albums of songs not only. recently my ipod plays the same song over and over again... I must have reset something... Please help

    You can find the manual here:

    http://help.Apple.com/iPod-touch/9/

    You must turn off the repeat function

  • Apple music unexpectedly goes to the next song!

    Greetings!

    • I can play my own music bought from iTunes. No problem at all.
    • When I try to play any song/music list Apple it skip to the next song. And the next. With a second delay. Apple music is currently unusable.

    I used the Apple music with no problems for about 6 months.

    Latest version of iTunes (12.4.3.1) and OS X (10.11.6) installed on a Mac Pro.

    Any thoughts?

    Hello Wognum,

    Thank you for using communities Support from Apple!

    It is my understanding that when Apple's music using it continuously jumps to the next song, without playing one of them.  I'll try my best to help with this.

    The first thing I would do, it's what is on the backup computer.  Nothing that I will propose should result in no data loss, but it's always a good idea to have a backup.  Your computer has software called Time Machine.  It is a fantastic software for backing up your computer.  Information on how to use Time Machine is available here:

    Use Time Machine to back up or restore your Mac.

    Assuming all other internet access works correctly, it is important to try to isolate what is causing this to happen.  The first thing to do to help isolate what is causing the problem is set up a test user account and see if Apple music works properly there.  Follow all the instructions that you will find on this page:

    How to test a question in another account on your Mac.

    If the problem does not occur in the test user account, then you will want to check the connection points of the account where Apple music will not play.  Try to remove the elements of connection and see if it plays properly.

    OS X El Capitan: If you think you have incompatible connection points

    See you soon!

  • Shuffle all is no longer works, I have to manually advance to the next song or listen to the same song over and over again

    Since the update to iOS 9.3.1 my iphone is more my music mix.  I can type shuffle all, but he played just the same song over and over until I manually advance to the next song.  Any suggestions on how to fix it?

    It's strange because on my iPhone 6 if I hit Shuffle All (at the top - it doesn't matter if my view of my library is on songs, Albums, artists) it certainly mixes between songs and does not play the same song over and over again.

    Just to be sure that we are talking about the same thing-, you tap my music at the bottom of the screen and then click on library above, then press Shuffle All? Because that's what I did and had no problems. Maybe try forced him to leave the music application (double clicking the HOME button, and then drag upward on music app) or even try to do a hard reset of the iPhone (now the HOME and POWER buttons until the Apple logo appears).

  • 7th generation... Please stop going automatically to the next song

    I'm angry that my Nano will not stop after each song.  It goes automatically into the next song.

    I realize account how this can be a good thing, but it would be convenient to be able to turn that off if you want.

    After some research, I don't know if this little machine is able to do this.

    In a nutshell: is there a way to allow the Nano to automatically stop at the end of each song?  Anyone?  Anyone?  Thank you.

    There is no setting for this on an iPod nano (and I don't know how to do on an iPhone either).  (Almost) everyone wants the next song on the list to play automatically.  You can create a playlist with only a song about it and synchronize with the iPod.  Then, when you play the song from the playlist (with the settings repeat off), the iPod stops playing after playing this song.

  • Windows Media Player does not play the full song - Y470

    Hello, I am having some problems with Windows Media Player, and I don't know how to fix it. The behavior that I meet is that WIMP would begin to play a song (from the library or a CD) and after playing a few seconds of the second OMP would jump to the next song. There is no consistency on the number of seconds that play before WIMP past to the next song. I can't find any option in the menu options that would cause this to happen.

    This started happening when I opened first WIMP. It's really strange. No idea what might happen? I would use another player, but I don't want to go through the hassle than other players (though very good) to provide compatibility with the synchronization with the mobile devices, playlists, etc... So I am forced to use WIMP. I need this problem well.

    It seems to happen with all players and all my music files. I can play the music files on my desk very well.

    Thank you


Maybe you are looking for

  • disaster of battery drain

    I just bought my 6s 2 days, it takes about 3 hours to reach 100% of battery under normal usage conditions, I put my phone in standby mode and never used during 30 minutes, she went from 38 percent to 28 percent, I almost stopped most applications and

  • HP 15-r126ne: Ram upgrade

    Im having 4 GB (4 * 1) of ram but I want to upgrade to 8 GB as well as HD 500 GB to 1 TB so is it possible to upgrade ram and HD with computers portable 15-r100 of hp series?

  • Handset wireless and ADSL connections__

    I have a toshiba satellite L500 with vista. I am currently set up with a Wi - Fi connection. Is it possible to also create a method NB5 ADSL - modem, 2 router so I can use it when I'm on my landline friends. Wireless modem must stay home for my wifes

  • Virtual defense Center showing not detailed network information

    Summary dashboard shows all the great stuff, but when I drill down, no detailed network information is displayed. The only detail I got is operating system info. but no host address IP Source or dest. What could be wrong? What to check? Running the l

  • How to configure Internet Information Services (IIS) in Windows compressed Surface

    Hello I bought the new Tablet Surface of Windows running on the operating system Windows RT. I want to configure Internet Information Services (IIS) in the device Surface. So I opened "Turn windows feature on or off" in Control Panel. But this isn't