can i just call up a function without it being in an onsomethingevent type thing…because i have a function called choosetrack, and i want it to do what the function is supposed to do, which is select a track for my sound player to play…however, i have the function being initiated on a onSoundComplete…and i need it to initiate as soon as my movie loads…and then again after the sound finishes…and then again…and again…
anyways…i have the again part down…i just need to start it right away
can anyone help?
TIA
Just call your function on frame one…
function startyoursound(){
//code and whatever
}
startyoursound();
That way when frame 1 gets hit, the function will be activated.
Well… that is if your movie STARTS on frame one, if not, then just call your function on whatever frame your animation starts on.
hei crazygamer!! i’m interested with your function choosetrack…
can i see it??
ok, here’s the code for the whole frame with my sounds…i have 3 files that I uploaded to my website…and I have flash load them up in order and play them…
[AS]
tracktoplay = 1;
function choosetrack() {
track = new Sound();
if (tracktoplay == 3) {
tracktoplay = 1;
} else {
tracktoplay += 1;
}
if (tracktoplay == 1) {
_root.audioMC.gotoAndPlay(1);
track.loadSound(“http://www.flashtek.devisland.net/intheend.mp3”, false);
}
if (tracktoplay == 2) {
_root.audioMC.gotoAndPlay(1);
track.loadSound(“http://www.flashtek.devisland.net/silverandcold.mp3”, false);
}
if (tracktoplay == 3) {
_root.audioMC.gotoAndPlay(1);
track.loadSound(“http://www.flashtek.devisland.net/dmxxgon.mp3”, false);
}
track.onLoad = function() {
_root.audioMC.gotoAndStop(3);
track.start();
};
track.onSoundComplete = choosetrack;
}
track = new Sound();
_root.audioMC.gotoAndPlay(1);
track.loadSound(“http://www.flashtek.devisland.net/intheend.mp3”, false);
track.onLoad = function() {
_root.audioMC.gotoAndStop(3);
track.start();
};
track.onSoundComplete = choosetrack;
[/AS]
whoa…looks scary now that I see it…i’m amazing…NOT
OK I have another question…all of the code above is in a frame on the main timeline…I have a movie clip also on the main timeline…and a fastforward button in that movie clip…how can I access the choosetrack function from my button…whould it be _root.choosetrack ();
???
thank’s… i think your function has to many repetition that can be shorted by array and can be simplified… i guess:)
but i’m not the one who able to do it…
i didn’t test this… but it should give you an idea on how to make it easier.
var i = 0, tracks = ["intheend.mp3", "silverandcold.mp3", "dmxxgon.mp3"];
Sound.prototype.chooseTrack = function() {
i++%tracks.length;
this.loadSound("http://www.flashtek.devisland.net/"+tracks*, false);
this.onLoad = function() {
this.start();
};
this.onSoundComplete = chooseTrack;
};
hope it helps. =)
there u are… like i said before…
where have u been kax??
on vacation!! =)
i was really tired of my life, spending all day in front of the computer.
edit. but now i’m really glad to be back.
wish could do that too
sorry man. :-\
but i can’t help it… i’m so glad! as good as new!! =)