dcsimg
A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: button to control item in playlist AS3

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    26

    Unhappy button to control item in playlist AS3

    ok call me stuuupid

    but I am sure this is simple, but can't seem to get it to work, in AS3


    I just want to have a button play an item in the media player playlist, for example, index 3.

    the media player is 'mediaplayer' and the button is 'btn3'
    so I tried this:


    ------------------AS3--------------

    btn3.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler31);
    function mouseDownHandler31(event:MouseEvent):void {
    mediaplayer.play(playlist.selectedIndex,'3');
    }

    ---------------------------

    also tried this:


    -------------------

    btn3.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler31);
    function mouseDownHandler31(event:MouseEvent):void {
    mediaplayer.playlist.selectedIndex.play(3);
    }


    -----------------

    grrrr


    I know I am using wrong syntax, I do not know AS3


    any help is appreciated

    cheers

  2. #2
    KoolMoves Moderator blanius's Avatar
    Join Date
    Jul 2001
    Location
    Atlanta GA
    Posts
    5,244
    You almost had it
    mediaplayer1.playlist.selectedIndex=(3);


    grrr thought I had this working, it does select the item but it doesn't play it. Not sure how to proceed
    Last edited by blanius; 01-14-2011 at 05:28 PM.

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    Thanks

    that works to select it visually, but it doesn't seem to actually play the audio for right index file...

    the right file is selected and highlighted - but it does not play the audio for that file...it plays whatever the previous file was (either the file that was default or any that is selected directly in the playlist with mouse)

    strange...

    what am I doing wrong?

  4. #4
    Junior Member
    Join Date
    Feb 2010
    Posts
    26
    aha!!

    I figured it out.

    this is the code:

    mediaplayer1.playlist.selectedIndex=(3);
    mediaplayer1.loadSelectedItem();

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center