Share Pastebin
Guest
Public paste!

Odin

By: a guest | May 9th, 2008 | Syntax: ActionScript | Size: 2.41 KB | Hits: 1,492 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. /*******************************************
  2. **     RadioStreamer - v1.1 build 14      **
  3. **         Last build 9 May 2008          **
  4. ********************************************
  5. **            Author: Odin HG             **
  6. **               Copyleft                 **
  7. ********************************************
  8. ** Notes:                                 **
  9. ** Download any playlist-file, open in    **
  10. ** a plain text-editor. Copy IP:PORT      **
  11. ** add ";stream;nsv" (Whithout the qoutes)**
  12. ** to the stream-ip.                      **
  13. ** Then, add it to the chans-array.       **
  14. ** chans[Channel#]=[title,ip,description] **
  15. ** use \n for linebreak in description    **
  16. *******************************************/
  17.  
  18. /* EXAMPLE-CHANNELS */
  19. var chans = new Array();//[title,ip:port;stream.nsv,description]
  20. chans[0] = ["Radio #1", "http://s2.viastreaming.net:7130;stream.nsv", "Latest hits.\nhttp://www.radio1.com"];
  21. chans[1] = ["Classics", "http://193.112.14.122:8080;stream.nsv", "Classical music 24/7.\nhttp://www.classicradio.com"];
  22. chans[2] = ["FunkRadio", "http://stream.funkradio.com:7130;stream.nsv", "Funk music!.\nVisit http://www.funkradio.com"];
  23. /* END OF CHANNEL-ARRAY */
  24.  
  25. stream = new Sound();//Create new sound
  26. current = 0;//Current channeř
  27. vol = 75;//Volume
  28.  
  29. function update() {//Update channel
  30.         if (current<0) {
  31.                 current = 0;
  32.         }
  33.         if (current>chans.length-1) {
  34.                 current = chans.length-1;
  35.         }
  36.         stream.stop();//Stop stream
  37.         stream.loadSound(chans[current][1], true);//Load new stream
  38.         setvol();//Set new volume
  39.         _root.txtChan = chans[current][0];//Set title-text
  40.         _root.txtDesc = chans[current][2];//Set description-text
  41. }
  42.  
  43. function setvol() {//Set volume
  44.         if (vol>100) {
  45.                 vol = 100;
  46.         }
  47.         if (vol<0) {
  48.                 vol = 0;
  49.         }
  50.         stream.setVolume(vol);//Set volume
  51. }
  52.  
  53. _root.onLoad = function() {//On load
  54.         update();//Update channel
  55. };
  56.  
  57.  
  58. _root.volu.onPress = function() {//Volume up
  59.         vol += 5;
  60.         setvol();
  61. };
  62.  
  63. _root.vold.onPress = function() {//Volume down
  64.         vol -= 5;
  65.         setvol();
  66. };
  67.  
  68. _root.nextChan.onPress = function() {//Next channel
  69.         current += 1;//Go to next channel
  70.         update();//Update channel
  71. };
  72.  
  73. _root.prevChan.onPress = function() {//Previous channel
  74.         current -= 1;//Go to previous channel
  75.         update();//Update channel
  76. };
  77.  
  78. _root.rndbtn.onPress = function() {//Random channel
  79.         current = Math.round(Math.random()*(chans.length-1));//Get random channel
  80.         update();//Update channel
  81. };