A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: attachsound level blues

  1. #1
    Bob (the singing sock)
    Join Date
    Aug 2000
    Location
    Århus, Denmark
    Posts
    472
    I have a movie "mixer.swf". In the movie I have a MC 'volume' that (onClipEvent(load)) attaches a linked sound 'sound1'.

    ... so far so good

    Then I load 'sound2.swf' that hold a linked 'sound2' into _level2.

    On a button I wish to attach 'sound2' to the mc 'volume' but I can't seem to get it right!

    onClipEvent (mouseDown) {
    volume.objSound = new Sound("sound1");
    volume.objSound.setVolume(100);
    volume.objSound.attachSound("_level2.sound2");
    volume.objSound.start(0, 1);
    }

    What am I doing wrong ... ?
    Help will be greatly appreciated
    /POD

  2. #2
    Senior Member
    Join Date
    Sep 2000
    Posts
    910
    Hi podenphant...I'm a little confused on what you're trying to do when you say you're trying to "attach 'sound2' to mc 'volume'"...

    Anyway, I would approach it like this, I think...

    In your "sound2.swf" where you have linked 'sound2'...go ahead and create your Sound Object on the main timeline of "sound2.swf"...

    objSound = new Sound(this);
    objSound.attachSound("sound2");

    ...the important thing in the code above is using "this" in the Sound constructor...it is necessary to do it this way whenever you use loadMovie on a Sound Object...

    ...then after you load it into _level2 of "mixer.swf" you can call it on a button or onClipEvent or frame action by...

    _level2.objSound.start(0,1);

    ...or set volume...

    _level2.objSound.setVolume(0);

    Hope that's what you're looking for...

    -pigghost-

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