Music plays fine from that scene in to the next scene , however, I have a button on the end frame of that 2nd scene, that jumps to a 3rd scene. When you click on the button, the background music stops. The 3rd scene has the bulk of my actionscript which runs the entire project. The first two scenes are pretty much a preload, and a animated scene that leads up to the 3rd scene, when a button is clicked from the 2nd scene Why would a button press stop all sounds from continuing? Flash 8 Version: http://www.arus.org/album/albums/userpics/10001/soundtest.zip this is a slimmed down version of my project, but it does exactly the same thing.
I dont have Flash 8 but can probably help anyway... In Flash scenes are all actually thought of as one big timeline so if you play one scene to the next Flash sees it as continuous whereas if you use the goto methods you are jumping scenes which may obviously break your sound. Since you're just moving from the end of one scene to the next, try changing the actionscript of the button to play(); instead of gotoScene();
Originally posted by: caskater I dont have Flash 8 but can probably help anyway... In Flash scenes are all actually thought of as one big timeline so if you play one scene to the next Flash sees it as continuous whereas if you use the goto methods you are jumping scenes which may obviously break your sound. Since you're just moving from the end of one scene to the next, try changing the actionscript of the button to play(); instead of gotoScene(); Im not using gotoScene(); the buttons have this: on (press) { gotoAndPlay("cars"); } which are frame labels.
You're still using a goto method which is frame hopping... therefore will still break your sound. Use the play(); command. Also its good form to stay away from placing actionscript on actual instances themselves and instead reference actionscript by instance name in the main timeline. It helps to identify better where actionscript code exists. Regardless... try changing your code above to be: on (press) { _root.play(); } But if I were you i'd create an Actions layer in the timeline and then use the following code: myButton_btn.onRelease() = function { _root.play(); } Where myButton_btn is the instance name of the button on the stage.
Originally posted by: caskater You're still using a goto method which is frame hopping... therefore will still break your sound. Use the play(); command. Also its good form to stay away from placing actionscript on actual instances themselves and instead reference actionscript by instance name in the main timeline. It helps to identify better where actionscript code exists. Regardless... try changing your code above to be: on (press) { _root.play(); } But if I were you i'd create an Actions layer in the timeline and then use the following code in an empty frame: myButton_btn.onRelease() = function { _root.play(); } Where myButton_btn is the instance name of the button on the stage. It still doesn't answer why it does this. This is why you need to see the file ( i can't save it lower than flash 8 because the computer im on doesn't have flash 8 installed). It works fine from scene 1 to scene 2 with the Frame jumps (as you call it). this is at the end of the movieClip in Scene1 : stop(); _root.gotoAndPlay("second"); So it jumps to the second scene, frame lable called "second". The music continues to play. Its only when it reaches the buttons in scene two at frame "starts"; when I click on that button to goto the next scene (which is only to the frame label) that's when the music stops playing So, why does the BG music work fine from scene 1 to scene 2 but when a button is pressed and goes to scene three it stops? This is the initial coding I have in scene three that the button would "jump" to: stop(); var clunking:Sound = new Sound(this); clunking.attachSound("clunk"); clunking.setVolume(100); clunking.stop(); // ----- SFX 2 ----- var boing = new Sound(this); boing.attachSound("spring"); boing.setVolume(100); boing.stop(); Which adds two "sound effects" to the project. I dont see anything in this code that would cause the bgmusic to stop playing.
You used: new Sound(this); 3 times. Do you know what the significance of this is? It is the channel in which the sound is played. So, if you are placing all the sounds in the same channel, they will all be controlling the same sound. So, when you hit the cars frame, you will be putting a new sound into the channel, and stopping it, which will obviously stop the previous sound (the song) from playing. To remedy, create 3 clips, one for each sound and then pass each clip for the target/channel. So: createEmptyMovieClip("sfxbg_mc",0); var bg_music:Sound = new Sound(sfxbg_mc); bg_music.attachSound("bgmusich"); bg_music.start(0, 9999); bg_music.setVolume(45); // ----- SFX 1 ----- createEmptyMovieClip("sfx1_mc",1); var clunking:Sound = new Sound(sfx1_mc); clunking.attachSound("clunk"); clunking.setVolume(100); clunking.stop(); // ----- SFX 2 ----- createEmptyMovieClip("sfx2_mc",1); var boing = new Sound(sfx2_mc); boing.attachSound("spring"); boing.setVolume(100); boing.stop();
Originally posted by: NSurveyor You used: new Sound(this); 3 times. Do you know what the significance of this is? It is the channel in which the sound is played. So, if you are placing all the sounds in the same channel, they will all be controlling the same sound. So, when you hit the cars frame, you will be putting a new sound into the channel, and stopping it, which will obviously stop the previous sound (the song) from playing. To remedy, create 3 clips, one for each sound and then pass each clip for the target/channel. So: createEmptyMovieClip("sfxbg_mc",0); var bg_music:Sound = new Sound(sfxbg_mc); bg_music.attachSound("bgmusich"); bg_music.start(0, 9999); bg_music.setVolume(45); // ----- SFX 1 ----- createEmptyMovieClip("sfx1_mc",1); var clunking:Sound = new Sound(sfx1_mc); clunking.attachSound("clunk"); clunking.setVolume(100); clunking.stop(); // ----- SFX 2 ----- createEmptyMovieClip("sfx2_mc",1); var boing = new Sound(sfx2_mc); boing.attachSound("spring"); boing.setVolume(100); boing.stop(); Thank You! didn't realize it was something that simple to do! Thank you!
Actually, spoke a little too soon by dong this: // ----- SFX 1 ----- createEmptyMovieClip("sfx1_mc",1); var clunking:Sound = new Sound(sfx1_mc); clunking.attachSound("clunk"); clunking.setVolume(100); clunking.stop(); // ----- SFX 2 ----- createEmptyMovieClip("sfx2_mc",1); var boing = new Sound(sfx2_mc); boing.attachSound("spring"); boing.setVolume(100); boing.stop(); By doing this, I do not have to put the streams into frame then? As I have it currently since they are being "loaded" into a movieClip
Actually, spoke a little too soon by dong this: // ----- SFX 1 ----- createEmptyMovieClip("sfx1_mc",1); var clunking:Sound = new Sound(sfx1_mc); clunking.attachSound("clunk"); clunking.setVolume(100); clunking.stop(); // ----- SFX 2 ----- createEmptyMovieClip("sfx2_mc",1); var boing = new Sound(sfx2_mc); boing.attachSound("spring"); boing.setVolume(100); boing.stop(); By doing this, I do not have to put the streams into frame then? As I have it currently since they are being "loaded" into a movieClip. Right now, since I took the "sounds" out of the frames, I get no sound. If i keep the "sound" in the frames and use the above coding, they play automatically ( ie not observing the sound.stop();) I can't have them "play' as soon as it enter the frame
Oh right, since you are NOT exporting your sounds in first frame (for preloading purposes I assume), the sounds will need to exist on the channel timeline *I think*. So, either remove the preloader and get rid of the timeline stuff (and have a seperate file with loader and load the movie in) OR you could have 3 empty clips each with the sound on their timeline as you had on the _root timeline. Give them the instance names, like you have in the createEmptyMoviClip action and then the new Sound(sfx1_mc); should work.
Originally posted by: NSurveyor Oh right, since you are NOT exporting your sounds in first frame (for preloading purposes I assume), the sounds will need to exist on the channel timeline *I think*. So, either remove the preloader and get rid of the timeline stuff (and have a seperate file with loader and load the movie in) OR you could have 3 empty clips each with the sound on their timeline as you had on the _root timeline. Give them the instance names, like you have in the createEmptyMoviClip action and then the new Sound(sfx1_mc); should work. So I create a MovieClip within the library Put the "sound" in the first frame of this movieClip Put it on the stage : instance name of "bgmm" use this: var bg_music:Sound = new Sound(bgmm); bg_music.attachSound("bgmusich"); bg_music.start(0, 9999); bg_music.setVolume(5); it calls it up fine with the properties as defined (in the first scene) But if it jumps to the next scene, the background music then returns to 100 volume and still doesn't play in scene 3 I dont want to "export on first frame" because of other things iwthin my project that are affected if I dont have a preload sequence. This solution is not working, so Im pretty much back to square 1.
Hmmm... try what I said before, but just with the createEmptyMovieClip. And then, for each sound, set the Sync to Stop in the Properties Panel? Also, I noticed you have old code in Scene carsbike, folder Sounds, frame 1 of the spring layer. You should remove it.
Originally posted by: NSurveyor Hmmm... try what I said before, but just with the createEmptyMovieClip. And then, for each sound, set the Sync to Stop in the Properties Panel? Also, I noticed you have old code in Scene carsbike, folder Sounds, frame 1 of the spring layer. You should remove it. If I use this is the carbikes scene (either frame): // ----- SFX 1 ----- createEmptyMovieClip("sfx1_mc", 1); var clunking:Sound = new Sound(sfx1_mc); clunking.attachSound("clunk"); clunking.setVolume(100); clunking.stop(); // ----- SFX 2 ----- createEmptyMovieClip("sfx2_mc", 1); var boing = new Sound(sfx2_mc); boing.attachSound("spring"); boing.setVolume(100); boing.stop(); The soundfx on the buttons are "delayed" if I set the sound sync on the timeline to "stop" in the properties panel. What would be the "code" needed for the buttons to activate the sound to prevent the delay from happening. this is my current code on my buttons: on (press) { gotoAndPlay("starts"); clunking.start(); } So as it stands, if someone hits the button, the sounfx for that button is delayed and sometimes doens't even play.
How many times do I have to reply to this to get an answer?
Don't see what you're looking for? Try a search.
|