A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 36

Thread: volume buttons

  1. #1
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79

    volume buttons

    Please help....
    I am trying to create a volume control that will control the volume of my entire movie-regardless of what is playing. My control actually contains 10 little buttons rather than the typical slider.
    I want each of the buttons to represent a different volume: ie button 1 will be the minimum and the last button will be max vol and then everything inbetween.
    Being a complete novice i just cant get to grips with what actions i need to give each button to acheive this (i assume actionscript is used, although bear in mind that this is like Japeneese to me).

    To see what i mean, please see my test site at www.martyn.guitarman.ukonline.co.uk


    Thanks in advance

  2. #2
    undead creature necromanthus's Avatar
    Join Date
    Feb 2002
    Location
    ROM
    Posts
    1,890
    Download and study this example:
    http://necromanthus.com/KoolMoves/SoundTracks.html

    p.s.
    Nice work there.
    Congrats !

  3. #3
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    http://www.diversioncentral.com/mp3/t.html
    http://www.diversioncentral.com/mp3/t.zip

    This is my version. I like your site also. Please post again when you are finished.
    Any programming language is at its best before it is implemented and used.

  4. #4
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    many thanks tmoore935 for those examples. i was slightly confused by necromanthus' reply (no offence intended) and after 4 days of going in circles, your reply has stopped me throwing my pc outta the nearest window.

    cheers again, and i will letyou know how i am getting on with the site.

    imladris

  5. #5
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    thanks for your help again tmoore935. a quick question - using your example, what changes would i need to make to get the mp3 file to play automatically rather than use the "play" button, and also to stream rather than download.
    thanks again for all your help

    imladris



  6. #6
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    To see what I have:
    http://www.diversioncentral.com/mp3/stream2.html


    The fun file:
    http://www.diversioncentral.com/mp3/stream2.fun

    Let me know if it works for you.


    This was from a couple of weeks ago. Looking at your own site which is pretty good, you should have no problem combinig the two fun fules for your needs.
    Any programming language is at its best before it is implemented and used.

  7. #7
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    Thanks for that tmoore935, I will take a look at the files you provided and have a play - some nice bits on there that i hadn't thought of like displaying bytes loading/loaded and displying current volume. That will keep me busy for a while.
    One quick question - what does 1024 refer to in loading and loaded lines of the action scripting (?) as the mp3 file you provided in the example was 842kb.

    Thanks again (i'll mention you on the credits as i wouldn't be getting this far without some outside help)

    imladris






  8. #8
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    Originally posted by imladris
    [BOne quick question - what does 1024 refer to in loading and loaded lines of the action scripting (?) as the mp3 file you provided in the example was 842kb.

    imladris


    [/B]

    If you remove the 1024 you would get 862208. If you divide that by 2^10 or 1024, you get KB which is easier I think to comprehend. It works frame by frame so it is not perfect but seems to work with koolmoves and gives some idea to the user of what is going on.
    Any programming language is at its best before it is implemented and used.

  9. #9
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    Dear tmoore935

    I can't thankyou you enough for all the help - my first test song is now uploaded at www.martyn.guitarman.ukonline.co.uk

    I have one final problem (HONEST!!) that you may be able to help me with:

    Level 0 contains the main interface which automatically loads the media base into level 2 (level 1 will be used for the information channels).

    The media base is basically an amended version of the files you provided me with.

    What I need to achieve is this:

    Each of the songs listed will play automatically one after the other with the option of using the "previous" and "next" buttons to skip backwards and forwards.

    Do you have any idea how I can amend the media base to achieve these two things?

    ONCE AGAIN MANY THANKS & PLEASE FEEL FREE TO TELL ME TO GET LOST IF I'M BEING A PAIN IN THE BUTT

    IMLADRIS
    Attached Files Attached Files

  10. #10
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    Originally posted by imladris
    Dear tmoore935

    What I need to achieve is this:

    Each of the songs listed will play automatically one after the other with the option of using the "previous" and "next" buttons to skip backwards and forwards.

    IMLADRIS
    I did this with my last web site. but I used flash mx. So give me a day or two to look it up and I will post the code that I used. But i remember that I used some method to determine when the song was at 99.9 percent(similar to a preloader) then I had used loadMovieNum to the same level as the first player. This was an If statement. But the songs were swf's. with mp3's it is easier.
    Any programming language is at its best before it is implemented and used.

  11. #11
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    This is what I used on my last mp3 player which was in flash MX:

    var total = Math.round(_level1.getBytesTotal()/1024);
    var loaded = Math.round(_level1.getBytesLoaded()/1024);
    _level1.percent = Math.round((_level1._currentframe/_level1._totalframes)/.01);

    // to load the second song
    if (_level1.percent>=99.9) {
    loadMovieNum("player2.swf", 11);
    stop();
    stopAllSounds();
    }

    It actually loaded a new player but it did work very well.
    Also go her and go to Fact #25 at:

    http://www.flashkit.com/board/showth...hreadid=299918
    Any programming language is at its best before it is implemented and used.

  12. #12
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    I came up with a simple way to run one song after another. Each song is only for a few seconds. There are three songs. (These could be placed inside of another movie so as to control the volume and keep it the same with all the songs). This is a simple demo with no graphics. player1.html is the only html page needed as the other two swf's will load inside of it. This works in IE and firefox. When i used this method before, I tested on several different computers and it seemed reliable. I am sure there are easier ways to do it.

    http://www.diversioncentral.com/stream/player1.html
    Any programming language is at its best before it is implemented and used.

  13. #13
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    Here are the zips
    Any programming language is at its best before it is implemented and used.

  14. #14
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    Dear tmoore935

    My knowledge of actionscript is Zero, but i had a thought on an easier way which you may be able to help with (this all refers to the Demo001 zip i provided before).
    I have changed it to 2 frames with a stopmovie function on frame 2. Then i have added more (blank for the moment) frames. If i created the bits and bobs needed for the next mp3 in frame 3 (as done previously) would i be able to add to the prevoius code (below) to tell the movie that on sound stopping goto frame 3. This would solve my problem and also make manual navigation very easy.

    i know there are commands such as "onSoundComplete" , "gotoAndPlay" etc, but can't work out how to put them together.

    Thanks

    Imladris



    onClipEvent (load) {
    Sound = new Sound();
    //to stream
    Sound.LoadSound("MADMAN2.mp3", true);
    Sound.start();


    }

    onClipEvent (enterFrame) {
    _root.dl4=Sound.getBytesLoaded()/1024;
    _root.dl5=Sound.getBytesTotal()/1024;

    }
    onClipEvent (enterFrame) {
    Sound.setVolume(_root.volume);
    Sound.setPan(_root.pan);

    }

  15. #15
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    on SoundComplete is something tyhat I learned just the other day from the sound forum. The following activates actionscript in order to load another player or you possibly could use it to load another song. This is what was in player1.swf:

    onClipEvent (enterFrame) {
    _root.dl4=Sound.getBytesLoaded()/1024;
    _root.dl5=Sound.getBytesTotal()/1024;
    //to load the next song
    Sound.onSoundComplete = function() {loadMovieNum("player2.swf", 0);}


    }

    in psudo tems it is nothing more than:

    Sound.onSoundComplete = function() {your actionscript goes here}

    you could put a geturl or something else. I have not tried the gotoAnd Play but it is a sharp idea. That way only one player is needed. This might work. It would send the swf to frame 6. make sure the tweens are set at 0 and that there is no preloader.

    Sound.onSoundComplete = function() {gotoAndPlay(6)};

    this would give you:

    onClipEvent (enterFrame) {
    _root.dl4=Sound.getBytesLoaded()/1024;
    _root.dl5=Sound.getBytesTotal()/1024;
    //to load the next song
    Sound.onSoundComplete = function() {gotoAndPlay(6)};

    }

    i am at work and I do not have time to see if this works. But try it out. I am no expert at actionscript but have read a lot on the different websites that are around.
    Any programming language is at its best before it is implemented and used.

  16. #16
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    i've had a go and it doesn't appear to work.

    my final script was:

    onClipEvent (load) {
    Sound = new Sound();
    //to stream
    Sound.LoadSound("MADMAN2.mp3", true);
    Sound.start();


    }

    onClipEvent (enterFrame) {
    _root.dl4=Sound.getBytesLoaded()/1024;
    _root.dl5=Sound.getBytesTotal()/1024;
    //to load the next song
    Sound.onSoundComplete = function() {gotoAndPlay(3)};




    }
    onClipEvent (enterFrame) {
    Sound.setVolume(_root.volume);
    Sound.setPan(_root.pan);
    }

    ps-i'm at work too hehe.

  17. #17
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    I will look later tonight or tomorrow when I can.
    Any programming language is at its best before it is implemented and used.

  18. #18
    Relaxing tmoore935's Avatar
    Join Date
    Oct 2001
    Location
    colorado, usa
    Posts
    1,713
    Add _root and it should work.

    Sound.onSoundComplete = function() {_root.gotoAndPlay("song2");}

    is what you need to change. I also named the frames by using View>>List key frames.

    the link for the demo is
    http://www.diversioncentral.com/stream/player1goto.html
    This will play forever and has only one swf to run it. The fun file is enclosed.
    Any programming language is at its best before it is implemented and used.

  19. #19
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    tmoore935


    THANKYOU!!!!!!! SORTED!!!! NOW I CAN GET DOWN TO IT!!! ONLY ANOTHER 20 ODD SONGS TO DO !!!

    JUST GOT THE 2 DEMO SONGS LOADED IN AT THE MOMENT, UNTIL I GET TIME TO FINISH OFF THE REST OF THE SITE.

    HEAR THE TWO DEMOS AND SEE THE DAMN THING WORKING PROPERLY AT www.martyn.guitarman.ukonline.co.uk

    SURE MY BOSS IS HAPPY AS I'LL NOW BE CONCENTRATING ON DOING SOME PROPER WORK HEHEHEHE


  20. #20
    Getting better day by day.....
    Join Date
    Mar 2005
    Location
    United Kingdom
    Posts
    79
    tmoore935
    my site is nearly finished now-thanks for all your help. the test version is running at www.martyn.guitarman.ukonline.co.uk.

    would be able to tell me why the attached doesn't show the vol or bytes values (d14 and d15)

    as far as i can see i've applied it exactly the same as before, but to no avail.

    it's driving me nuts!!!!!

    thanks again

    imladris
    Attached Files Attached Files

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