Copy link to clipboard
Copied
hello
i have a code to play and stop music with the URLRequest
the code is not on the main time line and when i run it , woks ok
BUT i want it to play only on one frame
when i move to the next frame,( i move to the next frame on my main class)
it's keep playing the music
how can i stop the music when i move to the nextframe?
Thnak you for your help
The Sound class does not have a stop() method. What you need to do is assign the play() method of your Sound object to a SoundChannel object and then use the SoundChannel object to stop() the sound.
Something like...
var sc:SoundChannel;
var a:Sound = new meme();
sc = a.play();
and when you want to stop the sound you stop the SoundChannel...
sc.stop();
Copy link to clipboard
Copied
Use the code that stops the music before you change the frame.
Copy link to clipboard
Copied
HI
i wrote this code to stop the music but give me an error
var a:Sound = new meme();
a.stop();
Line 63 | 1061: Call to a possibly undefined method stop through a reference with static type flash.media:Sound. |
i put the code at the main class also import import flash.media.Sound;
how can i fix the problem?
thank you
Copy link to clipboard
Copied
The Sound class does not have a stop() method. What you need to do is assign the play() method of your Sound object to a SoundChannel object and then use the SoundChannel object to stop() the sound.
Something like...
var sc:SoundChannel;
var a:Sound = new meme();
sc = a.play();
and when you want to stop the sound you stop the SoundChannel...
sc.stop();
Copy link to clipboard
Copied
hi
thank you
Copy link to clipboard
Copied
Please use titles for your postings that indicate the problem you are trying to solve instead of just saying "hi" all the time. Other people search these forums for help and the title of your posting is one way of making their search easier.
Copy link to clipboard
Copied
ok, will do it
sorry
Find more inspiration, events, and resources on the new Adobe Community
Explore Now