Copy link to clipboard
Copied
i downloaded this free flash template for a project im working on with friends but i want to place music in the background
var default_volume:Number = 0.6; // 0.00 to 1.00
var sound1:Sound = new music();
var music_channel:SoundChannel = sound1.play();
var music_volume:SoundTransform = new SoundTransform();
music_volume.volume = default_volume;
music_channel.soundTransform = music_volume;
sound_control.stop();
sound_control.addEventListener(MouseEvent.click, play_pause);
function play_pause(e:MouseEvent):void
{
music_volume.volume = default_volume;
if( e.target.currentFrame == 1 )
music_volume.volume = 0;
music_channel.soundTransform = music_volume;
e.target.play();
}
this came with it but it was disabled with /* so i took it out and now my project just flashes randomly and stops working, after i make it a comment again it fixes it, any ideas?
do you have an mp3 with class = music in your library?
do you have a movieclip with reference = sound_control within scope of that code?
if no to either (or both), you will see what you describe plus an error message (or two).
Copy link to clipboard
Copied
do you have an mp3 with class = music in your library?
do you have a movieclip with reference = sound_control within scope of that code?
if no to either (or both), you will see what you describe plus an error message (or two).
Copy link to clipboard
Copied
yer i put the music in my libary and created the class in action script called music and the movie clip is at the top of the whole script when this part is enabled the layer where the movieclip is(little speaker) gets enabled, if you get me
Copy link to clipboard
Copied
do you see an error message?
if yes, click file>publish settings>swf and tick "permit debugging". retest.
copy and paste the error message(s) and indicate the problematic lines of code mentioned in the error message(s).
Copy link to clipboard
Copied
its fixed now thx for the help couldt find the reference for the sound, seemed it removed itself and the sound_control layer wouldt show correctly
thx for the help and the debugging thing too
Copy link to clipboard
Copied
you're welcome.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now