MP3 Player Play/Pause?

I'm making an MP3 player.  I can't get the play/pause toggle to work.  I'm not sure how to have the event be toggled on and off. Sorry, I'm a newbie to flex.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:net="flash.net.*" xmlns:media="flash.media.*" creationComplete="mySound.load(myURLReq)" themeColor="#000000" borderColor="#000000" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#FFFFFF, #FFFFFF]">
    <mx:Script>
        <![CDATA[
            private function appInit():void {
                stage.addEventListener( KeyboardEvent.KEY_DOWN, keyPressHandler );
            private function keyPressHandler( e:KeyboardEvent ):void {
                // if the spaceBar is pressed then toggle play/pause
                if( e.charCode == 32 ) {
                    if( this.focusManager.getFocus() != toggleBtn ) {
                        this.focusManager.setFocus( toggleBtn );
                        // whatever happens when you click on the button you place here
                        // it's best to have a 'clickHandler' that calls another method
                        toggleBtnHandler();
            private function clickHandler( e:Event ):void {
                toggleBtnHandler();
            private function toggleBtnHandler():void {
                if( toggleBtn.label == "PLAY" ) {
                    toggleBtn.label = "PAUSE";
                } else {
                    toggleBtn.label = "PLAY";
        ]]>
    </mx:Script>
<mx:Button id="toggleBtn"
        x="10" y="70" toolTip="Press the spacebar to toggle label"
        click="clickHandler( event );"
        label="PLAY"/>
   <mx:Number id="myPos">0</mx:Number>
   <net:URLRequest id="myURLReq" url="01-amy_macdonald-dont_tell_me_that_its_over.mp3" />
   <media:SoundChannel id="mySoundChannel" />
   <media:Sound id="mySound" />
   <mx:Panel title="MP3 Player">
     <mx:Text id="prog" />
     <mx:ControlBar>
       <mx:Button id="play" label="PLAY" click="mySoundChannel = mySound.play(myPos, 0, null);" />
       <mx:Button id="pause" label="PAUSE" click="myPos = mySoundChannel.position; mySoundChannel.stop();" />
       <mx:Button id="stop" label="STOP" click="mySoundChannel.stop();" />
     </mx:ControlBar>
   </mx:Panel>
</mx:Application>

http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1248142&highlight_key=y&keyword1=mp3
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1249411&highlight_key=y&keyword1=mp3
http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1247499&highlight_key=y&keyword1=audio

Similar Messages

  • Creative MP3 player plays songs alphabetically instead of in track order

    I use a Creative Nomad Zen 20GB USB 2.0 MP3 player with iTunes 7. Lately, songs listed in the correct track order on a given album in iTunes show up listed and get played in alphabetical order when copied to the Zen.
    Any way in iTunes around this? I've been using XNJB, but it seems like it should be do-able in iTunes - especially since I wasn't having this problem in previous versions.
    I've searched the forum but seem to have missed what is probably a common issue. Please point me to the right thread if this is the case.
    Thanks, R.
    PowerMac G5 1.8   Mac OS X (10.4.7)  

    Also, I'm using iTunes 11.0.5, the latest version as far as I know.

  • [AS3] Music Player - Play/Pause

    At the moment, I am attempting to make a music player that will play a specific song of my choosing.
    I am stuck at the part where you can pause the sound, and then play it in the same place.
    I have tried many things such as using the timer utilities.
    Right now, when I pause it, it stops, and when I press play, it plays from the beginning.
    stop();
    var channel:SoundChannel;
    var soundCheck:Boolean = true;
    var song:Sound = new Sound(new URLRequest("song.mp3"));
    channel = song.play(); musicPlay.addEventListener(MouseEvent.CLICK, playSong);
    function playSong(evt:MouseEvent):void
        if (!soundCheck)
            channel = song.play();
        soundCheck = soundCheck;
    } musicPause.addEventListener(MouseEvent.CLICK, pauseSong);
    function pauseSong(evt:MouseEvent):void
        if (soundCheck)
            channel.stop();
        soundCheck = !soundCheck;

    Since there is no explicit pause method - when you pause store the position property of the channel object - and then when you play, use the position to play from.
    var pos:Number = 0;
    play Btn:
    channel = song.play(pos);
    pause Btn:
    pos = channel.position;
    channel.stop();

  • MP3 player supporting pause/resume

    I listen to Audio Books, and with tracks 60mins long I need to be able to pause the song, and resume listening hours or days later. I have the N73 and with the nokia music player if I pause the audio and exit (with exit button or the red hang-up button) when I go back into the player I have to fast forward back to the place I was.
    I can leave the player running in the background while the audio is going, but if you pause and get out the same way it actually closes the app.
    Does anyone have any suggestions of software that may support this?

    Hello! I found a workaround here:
    /discussions/board/message?board.id=smartphones&message.id=88560&query.id=253182#M88560
    Find the track/album you want, click options, then song details, then set Library to podcast.
    Confirmed working on an N78.
    It's baffling that the music player doesn't have this option as a default for all songs. The cheapest, crappiest mp3-players all support it so why shouldn't the nseries have it? Truly strange.

  • Flash mp3 player (pause player while the mp3 loads)

    The following text below is apart of the mp3 player that I have that plays a song, but when the website is launched the song playes right away, which I DO NOT WANT.   how do i add a mute to this so that it does not affect the loading process.
    fscommand("allowscale", "false");
    dd = new Sound();
    dd.loadSound(http://www.mywebsite/song/example/link, true);
    xx = bar._width;
    orginal_width = bar._width;
    _root.soundbtndis._visible = false;
    _root.soundbtndis.disabled = true;
    this.onEnterFrame = function() {
    t1 = int(dd.duration/1000/60);
    t1 = t1+" : "+int((dd.duration/1000-(t1*60)));
    ddf = int((dd.duration-dd.position)/1000/60);
    elapsed_sec = int((((dd.duration-dd.position)/1000/60)-ddf)*60);
    if (elapsed_sec<10) {
      elapsed_sec = "0"+elapsed_sec;
    if (ddf<10) {
      ddf = "0"+ddf;
    if (_root.stpd) {
      elapsed = _root.t1;
    } else {
      elapsed = ddf+" : "+elapsed_sec;
    //mo=dd.position/1000
    //elapsed = 
    vol = dd.getVolume()+" %";
    dur = dd.duration;
    pos = dd.position;
    per = (pos/dur)*100;
    m = (pos/dur)*100;
    bar._width = (m*xx)/100;
    drag._x = _root.bar._width+_root.bar._x;
    //drag._y = 136;
    if (stpd) {
      xx = 0;
    } else {
      xx = orginal_width;
    // function keys
    if (Key.isDown(67)) {
      pauseit();
    if (Key.isDown(88)) {
      playit();
    if (Key.isDown(86)) {
      stopit();

    this tutorial does not help.
    Since we are on this topic, does anyone know of a way to create an mp3 player that pauses other songs in your play list when you hit play? 

  • IPOD Touch is an MP3 player ???

    hi,
    Had some various replies that iPOD touch is an iPOD mp3 player foremost. This is the reply that we get due to some basic features missing in some of the other apps.
    All good, no worries, as it is a mp3 player after all.
    Here is my question:
    When in any other iPOD Touch App (e.g. MAIL, MAPS, Safari, etc.) and have the mp3 player playing a song how do I:
    Change the Volume
    Forward
    Pause, etc.
    At this stange it seems like I need to Navigate back to the Music player and the use the normal hot buttons.
    Is there any sort of shortcut where we can do the normal mp3 player functions (volume, pause, next song, etc.) without navigating all the way back. It is a bit annoying and seems like the old iPOD was better here as the mp3 player operating buttons were always available.
    (someone said that the iPhone has some buttons on the side to control the volume. So no need to navigate back to the music player to do this. However, am not sure how the other functions can be accessed without navigating all the way back).
    Does my question make sense> ?
    Message was edited by: iTunes_user

    thanks. it works if you are really fast and use your nail.
    maybe it would be better if we could tap on the iPOD top right play icon to bring up a basic menu with functions for the mp3 player.
    jr20079:
    please feel free to log this enhancement request as you have correctly identified this an issue. http://www.apple.com/feedback/ipodtouch.html
    What other functions do you think Apple should add to the home button double (use your nail) press?
    thanks again.

  • Flash-based MP3 player with specified frequency respon

    I'm looking into buying a flash-memory based MP3 player. I'm trying to get a quality player that has linear audio output. I am usually listening to Baroque music, both from CDs and from my own recordings. Here are my detailed requirements:
    - USB 2.0 hi-speed
    - flash memory
    - powered by standard batteries (AAA or AA)
    - specified frequency response, S/N ratio and THD
    For example, on the Zen Nano Plus specifications web page, I read
    - Signal to Noise Ratio: up to 90dB
    - Frequency Response: 20Hz to 20kHz
    - Harmonic Response Output: 0.%
    This appears quite weasel-wordy. For example, a S/N ratio of "up to" something says nothing ("I am up to 00 years old"), reasonable wording would be "S/N ratio of at least x dB". The frequency response does not specify the attenuation over the given frequency range, -30dB at 20Hz would not be ruled out. I prefer frequency response charts that show the function "attenuation (dB) over frequency on log scale". For example, those are readily available for many headphones and all reasonable microphones. Further, I can only guess that "Harmonic Response output" means THD. Moreover, there is no data for stereo separation/crosstalk.
    Since these data points relate to the headphones output of the MP3 player, measuring them is fairly easy, since no actual sound waves are produced.
    Has anyone measured any of the Creative flash products and can post the respecti've charts and data?

    Thank you for your answers.
    Yes, I'm technically minded (I'm German, in case you think that explains it :-) I just posted hoping for the off-chance that someone was curious enough to have performed some real measurements.
    The idea for generating the WAV file would be NOT to try to record a real oscillator, but instead create the WAV file with a PC audio editor where you can say "give me a kHz tone for 0 seconds". You would do this on a log scale from, say 20 Hz to 20 kHz, save as WAV, move the resulting file to the MP3 player, play it, and check the output levels for each frequency. Calculating THD is probably more ambitious, but if your 'scope shows some frequency skew, that would probably be interesting, too. I don't know whether a traditional 'scope has enough amplitude resolution to deal with 90 dB S/N ratio (that's a factor of 30000 between signal and noise floor).
    I don't think I can attach files

  • MP3 Player that can play one track, and than stops.

    Hi all,
    For an art project, I am looking for a mp3 player that can playback in "single track play" mode.
    Meaning that it will automatically stop/pause?after playing one track, and remain paused until I press "play" to start playback of?the next song?(I don't want to have to press "pause" or "stop" after each song is played).
    Are there currently any mp3 players by Creative Labs?that have this "single track play" capability?
    Thanks in advance for your recommendations!
    Best regards,
    Eibert Draisma.

    bigsavz wrote:
    To be honest I don't need a lot of people commenting on this.  I need Apple to comment ...
    This is a user-to-user forum. Apple does not respond to posts here. You can give Apple your feedback on the Feedback page:
    http://www.apple.com/feedback
    They don't respond directly there, either. And once you post something here, people will comment as they see fit, regardless of what you originally hoped for. That's just the way it is with a public forum.
    Try Groove for iPad. People seem to think it's a great replacement to the previous music app.

  • I have copied my CDs into iTunes  (currently running v11) to play on my iPod.  I have now bought a non Apple mp3 player to use when I am out running.  How can I copy the many tracks I want from iTunes onto the new player?

    I have copied my CDs into iTunes  (currently running v11) to play on my iPod.  I have now bought a non Apple mp3 player to use when I am out running.  How can I copy the many tracks I want from iTunes onto the new player?
    Thanks

    I tried Notpod but can't get it to work.  Part of the problem, I suspect, is that I can't create a folder on my player (a SanDisk Clip+).  I also can't do this in Windows Explorer.  Whilst I can see the Clip+ in Explorer, the option to create a new folder isn't there.
    The error mesag I get in Notpod is:
    "Unhandled exception has occurred in your application.  If you click Continue, the application will ignore this error and attempt to continue.  If you click Quit the application will close immediately.
    InvalidArgument=Value of '0' is not valid for 'SelctedIndex'. Parameter name: SelectedIndex"
    Then, when I plug the Clip+ into a USB port, iTunes thinks it is my iPad - which is because, I guess, Notpod hasn't worked.
    I can drag and drop files from the Music folder where my iTunes tracks are stored onto the Clip+ and they get converted but I'd rather synchronise a Playlist from iTunes if I can.
    Thanks anyone who can help

  • Cd/mp3 player was not playing all tunes burned to disk

    Got my Mojo workin'.
    That's a TDK "Mojo" CD-MP3 Digital Jukebox.
    Sit back and relax while I tell of my Grand Journey of Exploration. (There is a question below too.)
    I had made a some iTunes playlists of MP3s, and decided to burn them on CD-R disks for my portable player. I had them all sorted by Artist and Album. The burn process seemed to go well, but when I loaded the first disk into the Mojo, it seemed to scan the entire disk and count all the tunes. It finished counting after it found all 193 titles. However, when I tried to play them, it would only play the first 26 tunes or so. (Another disk I had burned at the same time (different playlist) gave similar unsatisfactory results, something like 19 out of 186 tunes.) I knew the Mojo was not a current model, and thought maybe there was some weird file incompatibility thing going on.
    I popped the disk into my son's CD/MP3 player ("Koss" brand), and it managed to find 30 or 40 of them. A bit better, but not perfect.
    I tried it in my DVD player, and it was able to play all 193 tunes. In fact, it loaded and started playing quicker than I had ever seen it do before. It usually thrashes and whirs for an annoyingly long time.
    The odd thing was that the Koss was able to play all 76 tunes on another disk I had burned over a year ago, on my wife's Mac, with a version of iTunes for Mac System 9.2. Unfortunately, those files were gone from her Mac so I couldn't see what the iTunes setup was. I was thinking maybe the newer version of iTunes had a bug or something.
    Then I inspected the old and new disks in the Finder and noticed that the new disk had a bunch of folders with the Artists' names, and each artist folder had folders within them with Album names, and the tunes were inside those folders.
    The old disk (which worked fine in the Mojo player) just had the MP3 files and no folders whatsoever. I knew I was onto something, but I couldn't figure out how to burn a folder-less MP3 disk from iTunes, as opposed to doing it manually via the Finder.
    I searched Apple.com > Support > Discussions > iTunes for Mac > Importing & Burning in iTunes for Mac yet again, this time using "folders" for the search term, and up popped several threads where people wanted files organized by folders on disks:
    http://discussions.apple.com/thread.jspa?messageID=1464192
    http://discussions.apple.com/thread.jspa?messageID=1791538
    http://discussions.apple.com/thread.jspa?messageID=781976
    ... which brought me to the document "iTunes: How to set the play order of songs on an MP3 CD", at http://docs.info.apple.com/article.html?artnum=60931
    So, I removed the columns for "Artist" and "Album" names from the playlist, and burned it, et voila! it worked just fine in my Mojo, which plays all 193 tunes. (Too bad I didn't fix the ID3 tags beforehand.)
    Now, for points:
    I had the playlist sorted by Artist, and here are the first four titles (of 193)
    Title ____________ Artist____________
    Relative Ways ...And You Will Know Us By The Trail Of Dead
    Mistakes & Regrets ...And You Will Know Us By The Trail Of Dead
    Jubilation 20 Minute Loop
    Queen of Pain Alkaline Trio
    Muffin57 All Natural Lemon And Lime Flavors
    ... etc.
    Then when I remove the "Artist" column so that it only shows the Titles, it resorts like this:
    Title ____________
    Blacken My Thumb
    Buckler
    After School Thunder
    Futuristic Genitalia
    Once In A Lifetime (Cul De Sac)
    ... etc.
    This is not the same as it was, nor is it alphabetical by Title.
    If I click on the Title column header of course, it is ordered alphabetically by title, like this:
    Title ____________
    (Do Not Feed The) Oyster
    (Got My) Rock Pants On
    3 Away
    27
    68
    Adventures In Conversation
    After School Thunder
    Algorithm Of Desire
    Alive and Amplified
    ... etc.
    Other than dragging all 193 tunes, one at a time, in order manually, how can I keep the original play order by Artist, without creating folders on the burned CD?
    There is talk of "Copy to Play Order" in the iTunes Help/Support files...
    To use this command, Control-click one of the songs in the playlist,
    and choose "Copy to Play Order" from the shortcut menu. Tip: These
    steps also apply to a playlist you have reordered directly (by clicking
    on one of the column headers like Artist or Album).
    ... but I don't see that option when I Control-click anything. The bottom menuitem in the popup menu is "Clear". Same results with Right-clicking.
    300 MHz "Blue & White" G3   Mac OS X (10.4.7)   iTunes 6.0.5

    Hmm. I see that the spaces have been chopped out in part of my first post, and it appears that I cannot edit it.
    For clarity's sake, these are the Artists' names, in the partial listing for Ordered by Artist example in my previous post:
    ...And You Will Know Us By The Trail Of Dead
    ...And You Will Know Us By The Trail Of Dead
    20 Minute Loop
    Alkaline Trio
    All Natural Lemon And Lime Flavors

  • HTML5/quicktime player plays and pauses several times a second

    We've been getting some weird entries in our statistics logging on our streaming media system, and I've managed to not-so-much recreate the problem as be around when it occurs.
    Playing about with the interface (scrubbing quickly, then playing/pausing repeatedly, etc) doesn't seem to trigger the problem - it just seems to happen occasionally after a few minutes of a player being open in full-screen mode.
    The actual symptoms are the the stream suddenly starts pausing and playing incredibly quickly - upwards of 10 times a second - and you can see the play and pause buttons swapping incredibly quickly. We're not getting this problem with any other of our players, and we're using the iPad's built-in player, not our own HTML5 player, although I'm still not entirely convinced it isn't a bug with our servers.
    The stream also seems to start looping, and as soon as it reaches the end of the stream it starts again, which is making me wonder if it's a bug with the UI itself, as if the play and pause buttons are getting triggered constantly, but changing the rotation doesn't stop it happening. I also wondered if it was something silly, like someone sneezing on the screen and the moisture triggering the touch screen, but that doesn't seem to be the problem either.
    Has anyone else seen this behaviour before? I don't seem to be able to directly trigger it - it just seems to happen occasionally.
    I'm trying to get a video of the symptoms, but it's not playing ball at the moment. If I can get it to do it again, I'll add a video example in a later post/edit.

    We've been getting some weird entries in our statistics logging on our streaming media system, and I've managed to not-so-much recreate the problem as be around when it occurs.
    Playing about with the interface (scrubbing quickly, then playing/pausing repeatedly, etc) doesn't seem to trigger the problem - it just seems to happen occasionally after a few minutes of a player being open in full-screen mode.
    The actual symptoms are the the stream suddenly starts pausing and playing incredibly quickly - upwards of 10 times a second - and you can see the play and pause buttons swapping incredibly quickly. We're not getting this problem with any other of our players, and we're using the iPad's built-in player, not our own HTML5 player, although I'm still not entirely convinced it isn't a bug with our servers.
    The stream also seems to start looping, and as soon as it reaches the end of the stream it starts again, which is making me wonder if it's a bug with the UI itself, as if the play and pause buttons are getting triggered constantly, but changing the rotation doesn't stop it happening. I also wondered if it was something silly, like someone sneezing on the screen and the moisture triggering the touch screen, but that doesn't seem to be the problem either.
    Has anyone else seen this behaviour before? I don't seem to be able to directly trigger it - it just seems to happen occasionally.
    I'm trying to get a video of the symptoms, but it's not playing ball at the moment. If I can get it to do it again, I'll add a video example in a later post/edit.

  • How to hide the Play arrow when player is paused?

    Hi,
    I wanted to hide the Play arrow that appears in the middle of the screen when player is paused.
    Users often pause the player to examine a schema, diagram, or somewhat else, and in that case, this arrow may hide some image details.
    Thanks

    No, I am not the author. I watch flash videos.

  • I can download a song to my mp3 player but the song does not play

    when i download the song it wiil not play but it is on the playlist on my mp3

    OK.
    Not sure why you are in the itunes forum.
    Your issue is with your MP3 player.  Go to their support page.
    Itunes syncs with Apple devices.  It has little or nothing to do with other players.
    Does your MP3 player support the file type of the song that your downloaded?

  • Playing purchased music on my mp3 player

    I need help! I am totally new to itunes and not very computer savy...I purchased a song but now I can't play it on my mp3 player because it says that the extension is not recognized by Windows Media Player. I tried to convert the song to MP3 but it says it's protected. Can I not save my purchased music to my Windows Media Player?

    Suzy,
    To convert protected iTunes files you need to burn them to audio CD first and then re-import that CD in MP3 format. If you are currently using a different import setting, you can change it in iTunes by going to File>Preferences>Advanced>Importing and changing the encoder setting to MP3

  • MP3 Player .swf Won't Play in Dreamweaver

    I've made a Flash mp3 player that plays just fine when opened alone. But when I put it into Dreamweaver, only the images appear, but neither the script appears nor the music plays?
    I've moved all associated files into the same folder in Dreamweaver, including the xml file, etc. Any idea on what I can do to make this player work?
    Thanks!!!

    The best guess I can hazard at the moment is that you are missing some other files (possibly swf's or image files) that the index.swf file is trying to load.
    If you do have other files that it loads and you have placed them where you believe they need to go, can you explain that arrangement folder-wise?

Maybe you are looking for

  • Send RFQ and PO from SAP R/3 to SRM

    Hi all, I am new to SRM and need send the RFQ and PO created in SAP R/3 release 4.7 for SRM Server 5.0. I am using a distribution model (ALE) between the systems with the message types REQOTE and ORDERS associated to IDOC types ORDERS02 and ORDERS05

  • Error when using Date Parameters...

    Hi everybody, I have a little issue. Ever since I upgraded my CRXI R2 to SP4 I've had a little problem using date parameters. The little calendar icon next to the parameter field no longer works. When I click it I get the following error message: An

  • Pro Applications Update 2008-05  Never going away.

    No matter how many times I say install this update every time I run the software update tool it is always there wanting to be installed. I am running Snow leopard. Let me know what other information I can provide to help. I have Logic Pro 8 installed

  • DataGrid with multi-row headers

    Hello! How can I have a DataGrid with header and sub-headers so to speak. Something like this: [     Main Header     ] [ sub1] [sub2] [sub3] Thanks!

  • How can I show outlook archived emails on iphone

    I archive my emails on my windows 7 laptop but want to be able to have access to those archived emails on my iphone. Is there a way to have the sync'd like the inbox and sent box are? Thanks, Jeff