A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Sound object

  1. #1
    I want to use the sound in my library rainHeavy with the sound object. I have a movie clip called heavyRain to have the sound attached.

    What I'm using now is:
    RainHeavy = new Sound(heavyRain);
    RainHeavy.attachSound("rainHeavy");
    RainHeavy.start(1,999);

    this doesnt work.

    I have read through the help files exstensively and it doesn't help. If you could give me some brand new code, or maybe spot whats wrong with mine... it would be great.

  2. #2
    Member
    Join Date
    Nov 2001
    Posts
    96
    Doesn`t appear to be anything wrong with your code. Have you set the properties for your sound in your library to "export for actionscript" and named it properly?

    Cheers

  3. #3
    Senior Member
    Join Date
    Feb 2001
    Posts
    124

    Re:

    I ran into this one a couple of weeks ago my self.
    Here's your problem:

    "RainHeavy = new Sound(heavyRain);"

    it should read:
    RainHeavy = new Sound();

    if you want it to stream, do this:
    RainHeavy.attachSound("rainHeavy", true);

    if you want it to loop infinitely, do this:
    RainHeavy.start(1,9999);

    Good luck!

  4. #4
    Member
    Join Date
    Nov 2001
    Posts
    96

    Re: Re:

    Originally posted by jharris
    I ran into this one a couple of weeks ago my self.
    Here's your problem:

    "RainHeavy = new Sound(heavyRain);"

    it should read:
    RainHeavy = new Sound();

    if you want it to stream, do this:
    RainHeavy.attachSound("rainHeavy", true);

    if you want it to loop infinitely, do this:
    RainHeavy.start(1,9999);

    Good luck!
    Nah! Amrpre`s code is fine. The first line merely associates the sound object with a particular MC, supposedly so that it`s easier to target and control.

    Usage

    new Sound([target])

    Parameters

    target The movie clip instance on which the Sound object operates. This parameter is optional.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center