flawlesstwins
08-10-2006, 05:16 PM
I am having the hardest time trying to figure out how to get the right actionscript to make my music play automatically when my site starts. I have came up with this so far. What I am doing is streaming instead of embedding because the website software i use won't allow me to embed. I put the action script below. But what seems to happen is i have to press play for the sound it doesn't come on automatically, I really just wanted the music to autmatically play and loop through all the frames because i want it with my flash intro which will be several frames and then once guest got to my homepage and other pages they have the option to pause it and then play it from where it paused from. I want the music to continue to play throughout the website and not start over each time someone clicks on something on a new page on the site. I hope you can help me I would really appreciate it, I didn't know how to google this type of question. thanks so much. this is my actionscript for my initial frame
this.onEnterFrame = function () {
myMusicDurationText=_root.myMusic.duration/1000;
myMusicPositionText=_root.myMusic.position/1000;
myMusicDurationText=Math.floor(_root.Sound.duration/1000);
myMusicPositionText=Math.floor(_root.Sound.position/1000);
//loading bar
myBar=Math.floor((((_root.Sound.position)/(_root.Sound.duration))*100));
}
Sound = new Sound();
Sound.loadSound("2.mp3",true);
SoundPosition=0;
SoundVolume=50;
SoundPan=0;
Sound.setVolume(SoundVolume);
Sound.setPan(SoundPan);
}
and this is for my play button action script
on (press) {
Sound.start(SoundPosition,0);
SoundPosition=0;
}
and this for my pause button
on (press) {
//Pause button
SoundPosition=Sound.position/1000;
_root.Sound.stop();
}
this.onEnterFrame = function () {
myMusicDurationText=_root.myMusic.duration/1000;
myMusicPositionText=_root.myMusic.position/1000;
myMusicDurationText=Math.floor(_root.Sound.duration/1000);
myMusicPositionText=Math.floor(_root.Sound.position/1000);
//loading bar
myBar=Math.floor((((_root.Sound.position)/(_root.Sound.duration))*100));
}
Sound = new Sound();
Sound.loadSound("2.mp3",true);
SoundPosition=0;
SoundVolume=50;
SoundPan=0;
Sound.setVolume(SoundVolume);
Sound.setPan(SoundPan);
}
and this is for my play button action script
on (press) {
Sound.start(SoundPosition,0);
SoundPosition=0;
}
and this for my pause button
on (press) {
//Pause button
SoundPosition=Sound.position/1000;
_root.Sound.stop();
}