A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: Repeating an action using a button

  1. #1
    Junior Member
    Join Date
    Aug 2003
    Posts
    16

    Repeating an action using a button

    Hey

    I'm trying to get make a combo box music selector, and when they hit the play button, the music plays. Right now I can get it to play when they select their first song, however I want to set it to where it will play more than one song, if the user wants to. For some reason you can only hit the play button once, and when you hit it the second time, nothing happens. The code I have for it is:

    on (press) {
    musicbox = musicbox.getSelectedItem().data;
    if (musicbox == "heretostay.mp3") {
    heretostay.loadSound("heretostay.mp3", true);
    }
    if (musicbox == "clickclickboom.mp3") {
    clickclickboom.loadSound("clickclickboom.mp3", true);
    }
    }


    I need to figure out how to set the play button to be clickable more than once, so the user can listen to multiple songs, instead of having to reload the entire movie just to play a different song then their first choice.

    Thanks

    Kyle

  2. #2
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397

  3. #3
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    That didn't help out all

    I have it so that it will load the respected files, but i just need it to repeat that action each time the button is pressed.

  4. #4
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397

  5. #5
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    EXACTLY!!!!!!

    i've got it set with the above code so that it will pick and play the song i want. but it will only do it once. do i need a loop or something?

    site is at www.specialmaneuversteam.com/SMT.html

    music stuff is up in right hand corner. You can load your first choice song, however after that you can't load another one.

    Kyle
    Last edited by kylemcgough; 08-17-2003 at 02:19 AM.

  6. #6
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    Did u figure it out on how I should code that?

    Kyle

  7. #7
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Well my example works! So it can be done...
    And mind you, with info I picked up on that link I gave you!

    If you had been less arrogant in your first reply, maybe I would of attached my .fla, but...

  8. #8
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    NOOOOOO!!!!!!

    i didn't mean to sound arrogant (and if u think im groveling so i can get help with this, your right )

    perty perty please help me oldnewbie

    Kyle

  9. #9
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Flattery will get you nowhere!

    But here's the .fla. Next time, watch it!
    Last edited by oldnewbie; 08-17-2003 at 08:15 PM.

  10. #10
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    Thank you so much!!!

    One question though while im still trying to implement it into my movie, this is streaming right? I've tried copyin exactly what you have and change the handler on my box to match yours, and changed it to my songs, but they don't play

    Thanks in advance again

    Kyle

  11. #11
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Yep! Are those long pieces?

  12. #12
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    They are about 3-4 minutes each, whole songs. I still can't figure this out. I guess if i keep messing with it enough, it'll be figured out

    Kyle

  13. #13
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Is this implemented now on your link?

    Can you post this sound mc's .fla?

  14. #14
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    It's with the entire movie that I have.
    I can email you the .fla or zip it and put it on our site for download. It's 11 MB zipped.

    Its not updated on the link I sent you yet no. But that's because the link I have up will play the selected tune, however it won't repeat that. It won't load a second tune, or start playing that tune again.

    But if u want I can post it on our site.

    Kyle

  15. #15
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    Yeah! Guess you should do that! PM me the link to the zip.

    I can't only get one tune to play on that link above!


    Going out for a ride... Will tune in later!

  16. #16
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    nm, its working now!!!!!

    Thank you

    Kyle

  17. #17
    Banned
    Join Date
    Apr 2001
    Location
    Montréal, Québec.
    Posts
    25,397
    With what you got in my .fla?

  18. #18
    Junior Member
    Join Date
    Aug 2003
    Posts
    16
    Yea. I got it workin with that flash file after I fooled around with it a little while, I realized my speakers weren't plugged in. Somehow they had been disconnected right when I was trying that.

    Kyle

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