• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Audio inside nested movie clip won't play with the animation

Community Beginner ,
Oct 10, 2020 Oct 10, 2020

Copy link to clipboard

Copied

The title explains the bulk of it, I'm in HTML5 canvas, and the movie clip plays fine, but the audio in it's timeline isn't playing with it. Here is all the relavent code

 

                var root = this;

                root.Combo.Wire1.gotoAndStop(4);
                
                root.Combo.Bomb.gotoAndPlay(5);
                setTimeout(Explosion, 9500);
            
                function Explosion(){

                       root.House.gotoAndPlay(3);
                    
                }

All of the words listed but not delcared (combo, bomb, house, Wire1, etc.) are the instance names of movieClips that I set up in the Adobe UI. If anyone has any ideas it would be much appreciated. Thanks!

 

TOPICS
Timeline

Views

901

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Oct 12, 2020 Oct 12, 2020

1. You aren't understanding the issue, because in HTML5, when you are inside a symbol the sounds can't be played during testing, because you can only set the sound to event inside a symbol rather than stream. So therefore with no stream audio, gotoAndPlay can't play it, what I was asking is if you could think of an event that would allow me to play it when I need it, which-

 

2. I found a solution for. In the library of where all your symbols, bitmaps, and sounds are, you need to set the sound a l

...

Votes

Translate

Translate
Community Expert ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

there's nothing you showed that would necessarily cause the problem but there's a lot unknown that would cause the problem.

 

if you suspect a code problem, open the test browser's developer console and look for an error.

 

one of the most common problems would be the sound not starting on a played frame and the sound having a sync property of event (instead of stream).  but obviously, no one can say that is your problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

There have been no errors and only one warning. The warning being "audio context was not allowed to start" which from my understanding is because modern browsers dont play audio without interaction first. There is plenty of interaction before we get to the part where the audio is supposed to play, so i'm really at a loss

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

Upon further looking the sound is set as event rather than stream inside the movieclip, however I can't change it to stream due to it being an HTML5 document, and while an easy fix would be to convert it to AS3, it's a class project so it has to be HTML5, can you think of anyway to kind of sneak an event in there in order to have it start playing? Or will I just need to move it to the main timeline?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

in what mc is your sound?

 

on what frame (remembering initial frame is 0) does your sound start?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

Sounds starts at frame 0, and the movieclip path is this.Combo.Bomb

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

start the sound on frame 5, if that's what you want it to play when you execute that

 root.Combo.Bomb.gotoAndPlay(5);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

My apologies I was looking at the wrong symbol. the sound starts on on frame 6, which with the conversion does equal root.Combo.Bomb.gotoAndPlay(5);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

That wouldn't work anyway because there is no option to set it to stream, only event

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 11, 2020 Oct 11, 2020

Copy link to clipboard

Copied

use console.log or alert to confirm you're goto is doing what you think

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 12, 2020 Oct 12, 2020

Copy link to clipboard

Copied

1. You aren't understanding the issue, because in HTML5, when you are inside a symbol the sounds can't be played during testing, because you can only set the sound to event inside a symbol rather than stream. So therefore with no stream audio, gotoAndPlay can't play it, what I was asking is if you could think of an event that would allow me to play it when I need it, which-

 

2. I found a solution for. In the library of where all your symbols, bitmaps, and sounds are, you need to set the sound a linkage name. For this example lets use "Bomb", with that set yu need to go just above, or just below the gotoAndPlay line in the frame (doesn't matter which), and put in this code

createjs.Sound.play("LinkageName");

 

Or for this example

 

createjs.Sound.play("Bomb");

 

Make sure to include the quotations in the code, I typed this all out for the sole reason as to mark it as the answer so someone else doesn't have to do hours of research to figure out a single line of code to fix it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 23, 2021 Sep 23, 2021

Copy link to clipboard

Copied

LATEST

I had a similiar problem with audio inside a movie symbol, it would not play when tested out to a browser. I stumbled on this solution. In the layer containing the sound, just draw something outside the stage (could be just a dot), now test the project  in a browser. You should be able to hear the audio play.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines