Forum Moderators: open
I am extremely new to flash and would really appreciate some advice.
I need to add a clickable button to a website that plays an audio file that is 1.3mb
I have turned to flash because using the embed method it streams badly on dial up and the client wants it to work on both dial up and high speed.
Is there a way to do this in flash? If so how?
Many thanks in advance
try this, its a simple 2 button movie clip start/stop 100 x 50 pixels, this code is on the actions layer on frame 1
The buttons have an instance name of play_btn and stop_btn you need to edit the two instances of "whatever.mp3" to suit.
(I appreciate this may be old code but it works fine)
-----------------------------------------------------
onLoad = function() {
if(_global.Behaviors == null)_global.Behaviors = {};
if(_global.Behaviors.Sound == null)_global.Behaviors.Sound = {};
if(typeof this.createEmptyMovieClip == 'undefined'){
this._parent.createEmptyMovieClip('BS_music',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
_global.Behaviors.Sound.music = new Sound(this._parent.BS_music);
} else {
this.createEmptyMovieClip('_music_',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
_global.Behaviors.Sound.music = new Sound(this.BS_music);
}
_global.Behaviors.Sound.music.loadSound("whatever.mp3",true);
};
stop_btn.onPress = function() {
stopAllSounds();
};
play_btn.onPress = function() {
if(_global.Behaviors == null)_global.Behaviors = {};
if(_global.Behaviors.Sound == null)_global.Behaviors.Sound = {};
if(typeof this.createEmptyMovieClip == 'undefined'){
this._parent.createEmptyMovieClip('BS_music',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
_global.Behaviors.Sound.music = new Sound(this._parent.BS_music);
} else {
this.createEmptyMovieClip('_music_',new Date().getTime()-(Math.floor((new Date().getTime()) /10000)*10000) );
_global.Behaviors.Sound.music = new Sound(this.BS_music);
}
_global.Behaviors.Sound.music.loadSound("whatever.mp3",true);
};
-------------------------------------
If I want to stop the music playing, or get it to play one of the other available files (by using a javascript function to check if it's playing for example, and if it is not, to play the next file) can that previous code work (ie, is that java scripting)? Or is that previous code for using in some other software? I tried similar code in a fairly blank but functional web page, and it didn't do much for me.
Any help would be appreciated
If your looking for a ready made flash music player just google it there a quite a few out on the web.