I have published a site and audio doesn’t play the first time the site loads. Audio starts only when the browser is refreshed.
NOTE: THE SITE IS FOR A BAND THAT USES EXPLICIT LANGUAGES.
link
If you guys have any suggestions or ideas as to why the audio doesn’t play the first time it loads… please give me some inputs. I’m out of ideas. Thanks a bunch!
waseem
March 25, 2006, 10:05pm
2
i hear it, wtf Nashvillie *******?
Didn’t play for me onload. Didn’t play for me on refresh either. I had to hit stop on the player, then start it.
hmmm… i’ll have to review the code again…
thanks guys
did you call vintage ?..ok here I am :geek:
And if you toss some code or the fla, I try help you
hi vintage
i’m calvin-vintage. anyhow, here’s the code in audio player scene:
[COLOR=#000000]**var**[/COLOR] mySound = [COLOR=#000000][[/COLOR][COLOR=#000000]][/COLOR];
[COLOR=#000000]**var**[/COLOR] loadedSound:[COLOR=#0000ff]Boolean[/COLOR] = [COLOR=#000000]**false**[/COLOR];
[COLOR=#000000]**var**[/COLOR] [COLOR=#0000ff]stop[/COLOR]:[COLOR=#0000ff]Boolean[/COLOR] = [COLOR=#000000]**false**[/COLOR];
[COLOR=#000000]**var**[/COLOR] mySoundPlaying:[COLOR=#0000ff]Boolean[/COLOR] = [COLOR=#000000]**false**[/COLOR];
initialize = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]!loadedSound[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]for[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]index[/COLOR] = [COLOR=#000080]0[/COLOR]; [COLOR=#0000ff]index[/COLOR] < [COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]audioNode[/COLOR].[COLOR=#0000ff]length[/COLOR]; [COLOR=#0000ff]index[/COLOR]++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
mySound[COLOR=#000000][[/COLOR][COLOR=#0000ff]index[/COLOR][COLOR=#000000]][/COLOR] = [COLOR=#000000]**new**[/COLOR] [COLOR=#0000ff]Sound[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
mySound[COLOR=#000000][[/COLOR][COLOR=#0000ff]index[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]loadSound[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]audioNode[[/COLOR][COLOR=#0000ff]index[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]attributes[/COLOR].[COLOR=#000080]file[/COLOR], [COLOR=#000000]**false**[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
loadedSound = [COLOR=#000000]**true**[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]stop[/COLOR] = [COLOR=#000000]**false**[/COLOR];
[COLOR=#0000ff]loadSound[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000ff]loadSound[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]onEnterFrame[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]![COLOR=#0000ff]this[/COLOR].[COLOR=#0000ff]stop[/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]
downloaded = mySound[COLOR=#000000][[/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]getBytesLoaded[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
total = mySound[COLOR=#000000][[/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]getBytesTotal[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#0000ff]if[/COLOR] [COLOR=#000000]([/COLOR]downloaded < total[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]this[/COLOR].[COLOR=#000080]title[/COLOR].[COLOR=#0000ff]text[/COLOR] = [COLOR=#ff0000]"downloading song..."[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000ff]else[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]complete != [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]this[/COLOR].[COLOR=#000080]equalizer[/COLOR].[COLOR=#0000ff]gotoAndPlay[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"start"[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
complete = [COLOR=#000080]1[/COLOR];
[COLOR=#0000ff]this[/COLOR].[COLOR=#000080]title[/COLOR].[COLOR=#0000ff]text[/COLOR] = [COLOR=#000000]([/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR]+[COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR]+[COLOR=#ff0000]". "[/COLOR]+[COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]audioNode[/COLOR][COLOR=#000000][[/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]attributes[/COLOR].[COLOR=#000080]title[/COLOR];
[COLOR=#0000ff]this[/COLOR].[COLOR=#000080]equalizer[/COLOR].[COLOR=#0000ff]_visible[/COLOR] = [COLOR=#000000]**true**[/COLOR];
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]!mySoundPlaying[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
mySoundPlaying = [COLOR=#000000]**true**[/COLOR];
mySound[COLOR=#000000][[/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]start[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000080]0[/COLOR], [COLOR=#000080]0[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR]
mySound[COLOR=#000000][[/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]setVolume[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]volume[/COLOR][COLOR=#000000])[/COLOR];
mySound[COLOR=#000000][[/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]onSoundComplete[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR][COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR] < [COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]audioNode[/COLOR].[COLOR=#0000ff]length[/COLOR] - [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
++[COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#0000ff]else[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000ff]_root[/COLOR].[COLOR=#000080]track[/COLOR] = [COLOR=#000080]0[/COLOR];
[COLOR=#000000]}[/COLOR]
mySoundPlaying = [COLOR=#000000]**false**[/COLOR];
initialize[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[COLOR=#000000]}[/COLOR]
initialize[COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];
hi vintage
i’m calvin-vintage.
anyhow, here’s the code in audio player scene:
var mySound = [];
var loadedSound = false;
var stop:Boolean = false;
var mySoundPlaying:Boolean = false;
initialize = function() {
if(!loadedSound) {
for(index = 0; index < _root.audioNode.length; index++) {
mySound[index] = new Sound();
mySound[index].loadSound(_root.audioNode[index].attributes.file, false);
}
loadedSound = true;
}
this.stop = false;
loadSound();
}
loadSound = function() {
this.onEnterFrame = function() {
if(!this.stop){
downloaded = mySound[_root.track].getBytesLoaded();
total = mySound[_root.track].getBytesTotal();
if (downloaded < total) {
this.title.text = "downloading song...";
}
else {
if(complete != 1) {
this.equalizer.gotoAndPlay("start");
}
complete = 1;
this.title.text = (_root.track+1)+". "+_root.audioNode[_root.track].attributes.title;
this.equalizer._visible = true;
if(!mySoundPlaying) {
mySoundPlaying = true;
mySound[_root.track].start(0, 0);
}
}
}
mySound[_root.track].setVolume(_root.volume);
mySound[_root.track].onSoundComplete = function() {
if(_root.track < _root.audioNode.length - 1) {
++_root.track;
}
else {
_root.track = 0;
}
mySoundPlaying = false;
initialize();
}
};
}
initialize();
Thanks!
hi vintage =)
i’m calvin vintage
anyhow… i found one error… one of the functions was named loadSound(). i changed it to loadAudio(), but, the same problem persists.