Skip to main content
Participant
August 4, 2013
Answered

Fixing music player

  • August 4, 2013
  • 1 reply
  • 719 views

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?

This topic has been closed for replies.
Correct answer kglad

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).

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
August 4, 2013

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).

daneleo5Author
Participant
August 4, 2013

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

kglad
Community Expert
Community Expert
August 4, 2013

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).