Copy link to clipboard
Copied
I am having a critical issue with sounds in Flash CS6 AS3 , I will make my question very simple. For Example: I have 3 Scenes in the Project "Scene 1" I have a Button in "Scene 1" which should take me to "Scene 3" when Clicked. the Problem is: all Sounds within MovieClips in "Scene 2" Automatically Starts , I am using this code:
I Thought that the above code should take me to "Scene 3" without any problems I don't know why Sounds from "Scene 2" starts while I am not going to "Scene 2" at all Please provide a simple and clear solution , take in consideration that I have a tremendous amount of movieclips in my real project , so stoping the sound of each movieclip might not be good for me as I have MovieClip inside MovieClip etc. Thanks in Advance |
that's a bug unrelated to scenes. the same problem occurs in a one scene timeline.
Copy link to clipboard
Copied
change your sounds' sync properties to event.
Copy link to clipboard
Copied
Well , Thanks for your instant replay .
All of my sounds are already events
I have already tried the following:
1 - Changing sounds to start and adding sound again in the last frame and setting the sync to stop.
2 - Using the SoundMixer.stopAll(); code.
3 - Using the currentFrame.Name within all movieClips where they sould play in the specified scene only , if(MovieClip(root).currentFrame.name == "Scene 2") { Play(); }else { stop();}.
4 - Creating a boolean variable in my class file and setting it's value to false by default and then in my button which takes my to Scene 3 change my variable to true and let the button take me to Scene 2 , and in Scene frame load i use this if statement if(isGothrough == true) { gotoAndStop(1,"Scene 3")} , so it first goes to Scene 2 and directly the Scene 3 and in this Case YES Sounds of Scene 2 does not plays in Scene 3 however I can't use this at all , for example I have a lot of buttons Like This
Button 1 >> Takes me to Scene 2
Button 2 >> Takes me to Scene 3
Button 3 >> Takes me to Scene 4
So I can't go to all the Scenes to stop there sound ,
I simply want to go to any Scene without playing anything from the rest
I need to jump to Scene directly
in my real project I have a lot and a lot of movieClips , Scenes etc.
so creating a class for each movieClip and then reducing that movieClips' volume level to 0 is not a real solution , I want something simple ,
I want to jump without playing anything from Scenes in between.
Copy link to clipboard
Copied
you must have the sound in scene 3.
to test create a new scene and change your goto.
Copy link to clipboard
Copied
What actually happens is that the playhead visits Scene 2, but in such a way that the objects in it are not built correctly. This means that even the Flash Player has no control over those improperly built items--and your code surely has no chance to get control of them. Just make sure your goToAndStop actually visits each scene on the way to your final scene, and this should fix a lot of problems. Also note that your embedded sounds will probably do better set to "stream" rather than "event."
Note that most people don't use scenes these days, but this problem exists even with just using labels.
Copy link to clipboard
Copied
Thanks kglad and Amy Blankenship for your comments ,
Well there is no chance for improperly , forget my real project just try this :
Create a new flash AS3.0 Project and create three of four Scenes let us create 4 Scene and place sounds in Scenes "2" and "3" , note: Sounds must be in movieClips , and set the sounds what ever you like stream , event or strat/stop and then create button in Scene 1 and let it take you to Scene 4 and see what happens (Sounds in Scene 2 and Scene 3 will start !) [and note that there is no codding in Scene 2 and Scene 3 so nothing is build improperly] , and I am just saying "Scene 1" and "Scene 2" etc , in real projects people use to name their Scenes.
So now should we consider this as a bug or what ?
Copy link to clipboard
Copied
that's a bug unrelated to scenes. the same problem occurs in a one scene timeline.
Copy link to clipboard
Copied
Yes, it is a bug and the workaround is to visit every scene briefly that is in between your scene and the destinitaion scene.
for example
protected function goToScene(sceneNumber:int):void {
if (sceneNumber >= thisSceneNumber) {
gotoAndStop(1, 'Scene ' + sceneNumber.toString());
}
for (var i:int=thisSceneNumber+1; i < sceneNumber; i++){
goToAndStop(1, 'Scene ' + i.toString());
}
}
Copy link to clipboard
Copied
Thanks kglad and Amy Blankenship for your comments,
Well we have spent a long time converting our project from Scenes to Frames , although it seems hard to work on Frames in our Case , however we did a very hard effort to convert our project and we rebuilded our class file and all the codes within the project because we thought that when going from frame 1 to frame 3 the sounds of frame 2 DOES NOT START , however we have discovered that we are wrong and guess what happened , The same problem occurred, and we did tried this in an empty project ,
When you add one movieClip and added a sound file in it , it works fine , however when you create another instance of that MovieClip or if you use the same sound file in another movieClip the problem occurs.
Amy Blankenship your code does not work at all , because if you actually go to the Frame/Scene the actual sounds start , and you're logic might be wrong , you're trying to call the same function from the function itself , we tried this with a do while loop where we made it to go to nextframe() and the loop never stops until the currentScene.name = ourDestinationScene
but the problem is still there
kglad I think you're right
Now what might be the solution to work around , take in consideration now we have two versions of our project so if anyone can help us solve it whether by Scenes or Frames
Copy link to clipboard
Copied
the solution is don't attach sound to timelines. use actionscript to play sounds.
sync'g sound and animation is more complicated but can still be done and that complication (which only exists when sync'g is needed) is the only drawback of using actionscript to play sounds.
Copy link to clipboard
Copied
You said your sounds are set to "Ev ent." Did you change them to "Stream," as I suggested?
Kglad, I use sounds on the timeline all the time, and as long as you're aware of the pitfalls and work around them, it works justfine (but you do have to have very good deductive and coding skills--ones that might be above the OP).
As it so happens, we've begun to move away from timeline sounds and toward a more actionscript-based synching scheme, but this is because it's difficult to get good sound quality on embedded sounds and because it's actually easier to code and maintain once you have a "langage" in place that is able to describe how to do all the synching and interpret that in the background. Writing such a language isn't trivial, though.
Copy link to clipboard
Copied
Once again thanks both of you for your continues support , well using actionscript sound is not an option , it will reduce the quality of our final product , we have a character and we use the timeline to sync the audio with his movements.
Anyway Stream seems to work I tried it on an experimental project , and will conduct an experiment on the real project I thought I did that before not sure but will try it very soon thank you.
The problem is historical , I tried Macromedia Flash 8 the problem exist , I thought Adobe rewrote the code ,
final thing I tried yet changing all sounds to start and then creating another movieClip and adding all sounds which starts automatically and setting there sync to stop , and adding this movieClip to the destination seems working but needs more testing , note:all sounds should be in the second frame within this movieClip , don't ask me why
Copy link to clipboard
Copied
you don't need to respond to this because i see you've found a solution that works for you. but for others that may read this thread, the following is not true.
"...well using actionscript sound is not an option , it will reduce the quality of our final product..."
Copy link to clipboard
Copied
it's extreme unfortunate, ( ) after implementing the solution I have discussed above in the whole project it seemed useless as the movieClip continues to stops the sounds and so the sounds never plays even if we toggled them to play with a button or a MovieClip, I tried in narrative scale but now I have tried it in a wide range , for some cases it may work fine however in my situation it's useless ,
And for Amy's Solution we also tried changing sounds sync to stream, every time we exported a warning was shown something like swf contains multiple sounds items and the problem exist , we noticed that if you're not using the same instance or the same sound file, changing to stream might work , but not always that’s wired ( ) .
kglad , You're right I haven't meant that, its only in my context as if I use AS sound there will be a problem syncing the audio with the object in the project.
OK Now, Since none of the solutions worked for me yet , can anyone think of a twist ? ( )
Copy link to clipboard
Copied
I don't think you'll get the issue of duplicate sound items if you don't have more than one library item with the same linkage and item name. When you select the sound for the timeline from the dropdown, it's pointing to the library item, so if there is only one, that's the only one you can point to.
I think at this point the twist is find someone who has enough experience and understanding of how to work with sound files to hire for your project. No, I'm not looking for work, I'm just saying it seems we've hit the limit of what someone can help you with without getting their hands into your code and this problem seems to be beyond your current skillset.
Copy link to clipboard
Copied
Thanks a lot for your continues support
Yes we were thinking about this because time is running out for us.
Copy link to clipboard
Copied
send me an email via my website: www.kglad.com>contact
if you want to hire someone to sync your sounds using actionscript.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now