A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Sound in keyframe

  1. #1
    Member
    Join Date
    Dec 2007
    Posts
    38

    Sound in keyframe

    hello,
    I'm just evaluating different uses of the timeline in conjunction with as3 (yes, I'm crazy ).
    Let's suppose you put a sound in a movieClip keyFrame using the IDE (not as3!!). When the playhead hits a blank keyFrame, the movieClip is removed and - unsurprisingly - the sound continues playing (because of the display list improvements you know ;-)) . This is particularly annoying if it's a looping sound.

    Now my question is:
    - how to remove this movieclip "cleanly" ?

    Any method, including actionscript 3, is welcome.

    I'm informed about the dispose(), Janitor, WeakReference, etc.. solutions.
    Unfortunately, I can't find a way to get a reference to the actual Sound() instance when the sound was set up with the IDE.

    I can't believe that adding sound with the IDE should be now considered as a "troublesome" pratice, but I'm ready to believe it

    Thx,

  2. #2
    Member
    Join Date
    Dec 2007
    Posts
    38
    sorry, I should have mentionned that I use CS3.

    Perhaps it's fixed in CS4? For example, blank keyFrame, or removeChild() => stops IDE sound automatically?

  3. #3
    Teacosy is coming ranoka's Avatar
    Join Date
    Jun 2003
    Location
    UK
    Posts
    123
    In the IDE, if you set the audio sync to Stream, then when the MovieClip stops/is removed then the audio also stops because it is synced with the clip.

    If you have your audio set to Event, then you pretty much can't stop it once it starts. This isn't linked to AS3, this has always been the behaviour in Flash regardless of the AS version.

    You could use code like:
    // STOP ALL SOUNDS
    SoundMixer.stopAll();

    Which will of course stop all your event sounds... but if you want granular control of your audio then you'll need to use ActionScript.

  4. #4
    Member
    Join Date
    Dec 2007
    Posts
    38
    If you have your audio set to Event, then you pretty much can't stop it once it starts. This isn't linked to AS3, this has always been the behaviour in Flash regardless of the AS version.
    mhh... you are right about "Event" mode, but I should have mentionned I used "Start" mode. In Flash8+as2 (export Flash 8), an IDE sound with "Start" mode will stop if the hosting clip is removed (by blank keyFrame or by removeMovieClip()).

    When I do the same in CS3+as2 (export Flash 8), it doesn't work any more.
    Then, it seems to be a bug in CS3 (at least with as2). Could anyone check if it was fixed in CS4?

    [Tip: moreover, in as2, creating a Sound() object on the movieClip having a IDE sound would allow control on this IDE sound:
    s = new Sound(theClipWithIDEsound);
    s.setVolume(50); // changes IDE sound volume
    s.stop(); // stops the IDE sound
    ... end of tip]

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