Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

hi

Guest
Feb 15, 2013 Feb 15, 2013

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

TOPICS
ActionScript
731
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 15, 2013 Feb 15, 2013

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();

Translate
LEGEND ,
Feb 15, 2013 Feb 15, 2013

Use the code that stops the music before you change the frame.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 15, 2013 Feb 15, 2013

HI

i wrote this code to stop the music but give me an error

var a:Sound = new meme();

            a.stop();

Line 631061: 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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2013 Feb 15, 2013

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();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 15, 2013 Feb 15, 2013

hi

thank you

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 15, 2013 Feb 15, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 15, 2013 Feb 15, 2013
LATEST

ok, will do it

sorry

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines