A Flash Developer Resource Site

Results 1 to 8 of 8

Thread: What! attachSound Won't Work in loadMovie???

  1. #1
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488

    What! attachSound Won't Work in loadMovie???

    What the hey? attachSound quits working when the movie is used in loadMovie?

    s1 = new Sound();
    s1.attachSound("sound1");
    s1.start(0,1);

    Works fine on it's own, not a peep out of it when loaded as an external to a clip. What's wrong?

  2. #2
    Moderator enpstudios's Avatar
    Join Date
    Jun 2001
    Location
    Tampa, Fl.
    Posts
    11,282
    Maybe because sound1 is the Action Script name of your sound in the loaded Movies Library and it doesn't exist in your main movies library.

  3. #3
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    No, it doesn't exist in the main movie. It shouldn't have to, it's in the loaded movie where it's being called from. And I am using:

    s1 = new Sound(this);
    s1.attachSound("sound1");
    s1.start(0,1);

    Or am I missing something in the targetting? The id name is not a dupe, I know that.

  4. #4
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    I think I must have a corrupt file. I can use the exact code above in a new movie, load it into another movie and it works fine. The sounds are only in the library of the external.

    The file I need this to work on will not do squat, until I drag the sounds to the main movie library. Then it purrs along like nothing was wrong. I hate it when the rules change in the middle of the game. Reminds me a lot of Nam.

  5. #5
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    Just in case your following this, it was a corrupt fla. I used an earlier model and rebuilt. Used the same code I gave above. No sound files in the main movie, and it works exactly as advertised.

    I hate it when it does that...

  6. #6
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    The most likely problem is that you refer to _root somewhere in the loaded movie so when it is inside another one the path is different and it doesn't work ...

  7. #7
    Registered User Ask The Geezer's Avatar
    Join Date
    Jul 2002
    Location
    Out In The Pasture
    Posts
    20,488
    No, no _root used, except in the buttons to make the parts of the loaded movie do their thing, and you have to use it there. And they all worked. What didn't work was the sound. But, as I mentioned, the problem ended up being a corrupted fla for the main movie. I've had several fla files get corrupted and just quit working before. I never found the problem, cause you can't see the source file of a fla. But it did start working with a new makeover, with the original sound code:

    s1 = new Sound(this);
    s1.attachSound("sound1");
    s1.start(0,1);

  8. #8
    Senior Member
    Join Date
    Aug 2002
    Location
    Dublin, Ireland
    Posts
    1,749
    no _root used, except in the buttons
    Then the buttons are probably the problem! (By the way, there is no need to use _root ANYWHERE.) If you upload your FLA, I'll have a look for you.

    When you load a movie inside another one, _root is a different location to when the movie is playing on the main timeline.

    As for file corruption: have you ever heard of the zebra diagosis? Just because it has hooves, doesn't make it a zebra, especially if you are in a country where horses are most common.

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