Highlighted

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

Community Beginner ,
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!

 

Correct answer by Ryna5FA2 | Community Beginner

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.

TOPICS
Timeline

Views

82

Likes

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

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

Community Beginner ,
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!

 

Correct answer by Ryna5FA2 | Community Beginner

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.

TOPICS
Timeline

Views

83

Likes

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
Oct 10, 2020 0
Adobe Community Professional ,
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.

Likes

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
Reply
Loading...
Oct 11, 2020 0
Community Beginner ,
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

Likes

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
Reply
Loading...
Oct 11, 2020 0
Community Beginner ,
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?

Likes

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
Reply
Loading...
Oct 11, 2020 0
Adobe Community Professional ,
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?

Likes

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
Reply
Loading...
Oct 11, 2020 0
Community Beginner ,
Oct 11, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Oct 11, 2020 0
Adobe Community Professional ,
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);

Likes

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
Reply
Loading...
Oct 11, 2020 0
Community Beginner ,
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);

Likes

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
Reply
Loading...
Oct 11, 2020 0
Community Beginner ,
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

Likes

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
Reply
Loading...
Oct 11, 2020 0
Adobe Community Professional ,
Oct 11, 2020

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Oct 11, 2020 0
Community Beginner ,
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.

Likes

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
Reply
Loading...
Oct 12, 2020 0