facebook

Help with button image needed

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #348428 Reply

    Uplink1001
    Member

    HI.
    Question: i have an image button, when it is pressed it plays a sound file.
    also has an active image for the button which changes the colour when pressed, would it be possible to have the active image stay on until the sound has finished playing.?

    Uplink1001

    #348437 Reply

    Code_A
    Member

    I do not believe there is a built-in method of doing this, but you should be able to make it happen by making a dummy button of what you want to show while the audio is playing. Just place the buttons one top of each other and then use the .hide() and .show() methods to toggle between displaying the buttons. You will need to setup a function to listen for the end of the audio.

    Here is an example (untested code, just showing the concept, not all code is here):

      
    //place code behind real button  
    $('#m1-screen-dummy1').show(); //show dummy button
    $('#m1-screen-push1').hide();  //hide real button
    var aw1 = AudioPlayerWidget.fromWidget('m1-test-audio1-container');
     
    function onEnd(event) {
        $('#m1-screen-dummy1').hide(); //hide dummy button
        $('#m1-screen-push1').show();  //show real button
    }
     
    // subscribe for events
    aw1.events.bind('ended', onEnd);   
    aw1.events.bind('ended paused', function(event) { console.log(event.type); });
     
    // unsubscribe
    aw1.events.unbind('ended', onEnd);
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Help with button image needed

You must be logged in to post in the forum log in