Skip navigation
Currently Being Moderated

controlling audio in a loaded swf

Jan 23, 2009 6:49 AM

I have several flash swf's that are about 10 - 20 min. each. I load these in a player that I have created as the user selects them from a menu in the main swf (a swf player basically). I can pause start and stop the swf's with no problem, but I can't seem to get a handle on controlling the audio. I have the audio in the loaded swf's timelines because I need to sync the audio with the animation taking place in those swfs. I COULD, take the audio out of the timeline (after syncing it), and then load it seperately, but it would be much cleaner for me to just have it in the timeline. I've resorted to the SoundMixer of the main swf to mute and change the volume, but I can't get hold of the Sound(), soundTransforms etc. of the loaded swf. To assign a play location for the soundChannel I need to access the loaded swf's Sound().Play() function, but I can't seem to do that. I have exported the timeline audio in it's actionscript, supplied a name (same as it's class name), and then tried to access it, but I can't seem to do it (yes I wrap the loaded.content variable in a MovieClip cast--that's how I can control the pause and play of the animation).

Tutorials I have found only seem to work with sounds loaded into variables, and none refer accessing timeline sounds in a loaded swf.

Has anyone done this before?

Thanks for helping
 
Replies
  • Currently Being Moderated
    Jan 23, 2009 8:07 AM   in reply to FlashKitty
    it seems as thought you only want to 'stop' and 'start' the sound on the timeline, correct?

    in that case you should be able to call:
    SoundMixer.stopAll();

    from the parent swf, when you call the playhead to stop as well. then once the playhead is initiate again the sound should start playing automatically.
     
    |
    Mark as:
  • Currently Being Moderated
    Jan 23, 2009 10:26 AM   in reply to FlashKitty
    i think that you may want to place a stop() action on the first frame of the movieclip's timeline, rather than doing so in the event handler, this might help keep the file from 'beginning' to play previous to the command to do so.

    add the SoundMixer.stopAll(); call to both the pauseMovie and stopMovie methods.

    make sure that your timeline sounds are set to 'stream' (properties panel)
     
    |
    Mark as:
  • Currently Being Moderated
    Jan 23, 2009 12:51 PM   in reply to FlashKitty
    you're welcome :)
     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points