Problem with streaming sound on first frame
I've been having some trouble with starting a streaming sound by putting script on the first frame of a movie. I've tried searching the forum and Google but can't find a categoric answer so would appreciate any assistance.
In summary, I have script on frame one to start a streaming mp3. It works the first time I load the page, but not on subsequent visits.
The details of my query are below...
To test what is going on I've created a very simple movie with just two frames, each of duration zero tweens (view example here)
On frame 1 I have the following code to start my sound and loop it. The code was obtained from this board...
Quote:
mysound = new Sound();
mysound.loadSound("somemusic.mp3", true);
mysound.onSoundComplete = function() {
mysound.start(0,999);
};
I have added a stop action on frame 1 and a text object that says "First Frame".
On frame two I have no code and a text object that says "Shouldn't be here!". This frame has a stop action.
When I first load the page then I get "First Frame" and the sound stream. If I then refresh the page, or navigate elsewhere and then come back, then I see "Shouldn't be here!" and get no sound. Therefore I have skipped over frame one, the streaming sound and the stop action.
I picked the issue up as the animation on my home page was not playing sound if you navigated around the site and then returned to the home page. The reason was the same as here - the stream was started on frame 1.
I can cure the issue by putting the sound script on frame 2, and leaving frame 1 blank (and removing the stop action!)
My question is:
Is frame one 'unreliable'? Is there a risk all actions get skipped?
The Macromedia website says that frame 1 is a GOOD place to put function definitions, but in the example here my frame one doesn't always occur so would that mean if I defined functions and variables on it then they may get missed?
I've noticed in KM that if you add a stop action to frame 1 it warns you that this is unreliable. Is this true of ALL script on frame 1?
I've posted the example swf file on a test area of my website (view example here) if you want to try it out. I must admit I've not tried using other browsers to view the page yet.
Thanks.
Re: Problem with streaming sound on first frame
Quote:
Originally posted by sdg_uk
My question is:
Is frame one 'unreliable'? Is there a risk all actions get skipped?
The Macromedia website says that frame 1 is a GOOD place to put function definitions, but in the example here my frame one doesn't always occur so would that mean if I defined functions and variables on it then they may get missed?
No risk at all !
I always use this keyframe for certain functions and I had no problems at all.
The "first keyframe issue" was solved a long time ago (I can't remember the flash player version).
Now talking about the first keyframe and KoolMoves :
In certain situations,some objects (shapes,images,sounds) are exported in the first frame, and this is VERY bad !
In the "Export Settings / Loading Considerations" you must set the "Image/Sound placement" to "just before they're needed".
Otherwise ... troubles !
;)