|
|
[f8]
I made a script to play one out of three mp3s at random when you goto my page there is also three buttons at the bottom so you can change the song if you want to. It works good on my computer, but it has trouble on my server. Songs randomly start over. The buttons are misix 1,2,3 and 0. Button zero stops the music. The random variable is called randmisix PHP Code:
//LOAD SONGS var music1:Sound = new Sound(); var music2:Sound = new Sound(); var music3:Sound = new Sound();
//BUTTONS TO CHANGE THE MUSIC misix1.onRelease = function(){ music1.loadSound("music1.mp3", true); music1.onLoad = function(success:Boolean) { if (success) { music1.start(); } }; music2.stop(); music3.stop(); muselex.gotoAndStop(1); srndupe.muselex.gotoAndStop(1); }; misix2.onRelease = function(){ music2.loadSound("music2.mp3", true); music2.onLoad = function(success:Boolean) { if (success) { music2.start(); } }; music1.stop(); music3.stop(); muselex.gotoAndStop(2); srndupe.muselex.gotoAndStop(2); }; misix3.onRelease = function(){ music3.loadSound("music3.mp3", true); music3.onLoad = function(success:Boolean) { if (success) { music3.start(); } }; music2.stop(); music1.stop(); muselex.gotoAndStop(3); srndupe.muselex.gotoAndStop(3); }; misix0.onRelease = function(){ music1.stop(); music2.stop(); music3.stop(); muselex.gotoAndStop(4); srndupe.muselex.gotoAndStop(4); };
// RANDOM MUSIC AT START var _randmisix:Number = random(3); if (_randmisix == 0){ music1.loadSound("music1.mp3", true); srndupe.muselex.gotoAndStop(1); muselex.gotoAndStop(1); } if (_randmisix == 1){ music2.loadSound("music2.mp3", true); srndupe.muselex.gotoAndStop(2); muselex.gotoAndStop(2); } if (_randmisix == 2) { music3.loadSound("music3.mp3", true); srndupe.muselex.gotoAndStop(3); muselex.gotoAndStop(3); }
Here is a link to my site :http://www.jakejilg.com/test/ ... It's not finnished so I've been testing it in a temporary directory
FlashKit > Flash Help > Flash ActionScript
Posted on: 11-21-2007, 08:42 PM
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
|
|
|