Copy link to clipboard
Copied
Hi Guys
I managed to get all my buttons work correctly. now i need some help with sound/music. I need the title music to play at the start of my project frames 1-28 where my first bit of frame by frame animation runs with it. But when I test project the animation runs ok but no music. But when i press button to go to another part of the project and return to home page the animation plays ok again and the music to but only for the duration of the short animation. I need the music the keep playing in that area 1/28 until the user press a button and move on.
Help! AlanY
put a stop() in your first frame and an intro message along with a button/movieclip to click to trigger your timeline to play().
(user's have to interact with browser files to permit sound to play.)
Hi I got the start button working ok.plays the animation to frame 28 and stop thats what I want. But I would like to have the musicto play at the same time and keep it confined inbetween frames 1 and 28 if that is possible!
it would be easier for you to add your start button to frame 1 and then put your sound on frame 2.
but you can start your sound with code on frame 1, if that's what you want to do.
That works to keep the sound in 1-28 but the sound now stops playing at 28. Would like the music to keep playing the hole music at 28 until the user clicks another button to take them out of that area.
yes, those are the sound functions. but you don't want to call start_soundF() until you want the sound to start and you don't call stop_soundF() until you want the sound to stop.
double click the linkage field > enter soundId (uppercase i, 9th letter in alphabet)
double click to the right of the highlighted box shown in your screenshot.
the listener function call and function name don't match. ie,
fl_ClickToGoToAndStopAtFrame_6
is not the same as
fl_ClickToGoToAndStopAtFrame6
ie, change one of them so they match.
excellent news!!!!
to close the browser tab, window.close();
NativeApplication.nativeApplication.exit();
you need to assign the linkage id to your library sound.
are you calling start_soundF()?
check the publish folder. there's probably an exe.
if not, change your target, too.
it's in the output name field path which in your screenshot is the same as the folder where you're saving your fla.
you have to use a non-self signed digital certificate, https://help.adobe.com/en_US/air/build/WS5b3ccc516d4fbf351e63e3d118666ade46-7ff0.html
the same code will work for all air (desktop, ios, android) versions.
nice. you're doing your own troubleshooting.
(it's definitely getting easier to help you.)
contact apple support for help.
p.s. did you pay the $100+?
Copy link to clipboard
Copied
you have a typo in line 5433 of that backup js file.
if you don't understand how to fix that, copy and paste lines ~5420 to ~5450 from that js file
Copy link to clipboard
Copied
Hi
Sorry but I don't understand about js files or how to get that information.
Copy link to clipboard
Copied
when you test or publish animate creates several files, by default, in the folder where you save your fla. you'll find your js file there.
Copy link to clipboard
Copied
Reverted back to copy I had saved before it all went wrong. I thought it was easier to do that! This copy Plays the sound in full in the 1-28 area but still keep playing when I move out of the area. nothing added to the button listners so far! I can try again with some help from your good self!
Copy link to clipboard
Copied
now change one button listener per my last message with that code
Copy link to clipboard
Copied
Runs through to frame 51 and stops with music playing all the time. Maybe I have the stop sound in the wrong place.
Copy link to clipboard
Copied
on frame 1 use:
this.sound1 = createjs.Sound.createInstance("soundId"); // eg, if linkage id = soundId
this.stop_soundF = function(){
this.sound1.stop()
}
this.start_soundF = function(){
this.sound1.play()
}
for the button_5 listener function use:
function fl_ClickToGoToAndStopAtFrame6(){
this.gotoAndStop(51);
this.stop_soundF();
}
Copy link to clipboard
Copied
runs through to frame 51 and stops but with no sound at all from 1-51
Copy link to clipboard
Copied
you must use:
this.start_soundF()
to start the sound. that's a change from my previous suggestion(s) which did not include the keyword "this"
Copy link to clipboard
Copied
Sound plays runs through to 51 sound plays continuously.
Copy link to clipboard
Copied
did you click button_5 prior to frame 51?
Copy link to clipboard
Copied
Hi
No never click 5 frames just ran continuously from frame 1-51.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I never got a chance to click button 5 because the test ran from frame 1-51 all the way through, without stopping at frame 28. and the sound played all the way too.
Copy link to clipboard
Copied
if you have something to stop the timeline on frame 28, open the console to check for errors.
p.s. punctuation often helps clarify your writing. eg, a period after click 5, would have been helpful.
Copy link to clipboard
Copied
Create a movieclip for your audio and make the audio as Event under the Sound properties. Now bring that movie clip to the main stage. In the 28th frame, anyways the animtion stops and waits for the user to click any one option, so in all the buttons that you have at the 28th frame, just add a the action: SoundMixer.stopAll(); within the eventlistener of each button. Now the audio will stop and if you have any other audio that is part of each section of the buttons, just place those musics within the particular movieclip. So when you come back to the home screen, by clicking any of the buttons from each of your sections, again add the same code for those buttons: SoundMixer.stopAll();. Now what this does again is, it will stop all the sounds and when it returns to the main home screen, it will start playing the movieclip audio that was added for the beginning section. One important thing here is, this will work, only if the audio is kept as event under the Sound properties. If this doenst help, I Happy to solve this once when you share a sample of your work by changing any confidential data from the file.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi Don't know how to make movieclip!
Copy link to clipboard
Copied
ignore @Giddy_personality5D25 message. while well-meaning, it doesn't apply to your project.
Copy link to clipboard
Copied
ok
Copy link to clipboard
Copied
Copy link to clipboard
Copied
copy and paste here the code for your button 5 on your ~27th frame (which should look like)
this.button_5.addEventListener("click", fl_ClickToGoToAndStopAtFrame6.bind(this));
function fl_ClickToGoToAndStopAtFrame6(){
this.gotoAndStop(51);
this.stop_soundF();
}
=============================
from the error message it looks like only
this.button_5.addEventListener("click", fl_ClickToGoToAndStopAtFrame6.bind(this));
is present and not the rest of the code i suggested.
Copy link to clipboard
Copied
Hi Alan,
Have attached fla file. Please run the file and let me know if this is what you are trying to achieve. A music starts playing in the beginning until a certain frame and stops for the usr to click on any of the options. Have kep 4 grey buttons that jumps to 4 different frames and a green button to jump to the beginning of the file. Whenever you click on any of the 4 grey buttons, it stops the music and goes to that particular frame. and when you click on the green button, it goes to the beginning and plays the music again.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
this.button_5.addEventListener("click", fl_ClickToGoToAndStopAtFrame_6.bind(this));
function fl_ClickToGoToAndStopAtFrame6(){
this.gotoAndStop(51);
this.stop_soundF();
}
This code is on frame 28 not frame 27