dcsimg
A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: IS there a command to start/stop audio that plays across frames??

  1. #1
    Junior Member
    Join Date
    Aug 2016
    Posts
    12

    IS there a command to start/stop audio that plays across frames??

    I am pretty new to Flash. My project will be a mobile game where users go from one page to another by reading text and making choices. A programmer helped me set this up, but I am able to add the content.
    Each page is a frame, where images and text are displayed along with decision boxes that let the player choose their path to the next frame.
    In terms of story, certain frames correspond to certain locations (for example, a bar). There is a definite starting frame and ending frame for each location, although once the user is at that location the sequence of frames can change depending on the user's choices. I'd like to play certain music while the user is at a certain location. SO when the use enters (starting frame), the song start playing and will continuously loop. The user goes from one frame to another depending on his choices, but as long as he stays at that location the music should play uninterrupted. When the user comes to the end of the story at that location and leaves, the music should end.
    So the start frame should have a tag - start playing song X
    And the ending frame should have a tag - end playing song x
    I know how to add audio to a frame, but I don't know how to add audio that plays across frames as I describe.
    Is this possible and what is the code to do it?

    Thanks!

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,773
    I'd suggest for sound you create another layer that contains code that controls the sound. I'm not sure if there are any good controls for sound embedded in the timeline directly.
    .

  3. #3
    Senior Member Alloy Bacon's Avatar
    Join Date
    Apr 2011
    Posts
    947
    Yes for as3/air:

    stop all sounds:
    PHP Code:
    SoundMixer.stopAll(); 
    to play a sound, give your mp3 in the library a linkage name such as login_song and the next part where it says 1 that's the amount of times to loop it in this call: playSound(login_song,1);
    PHP Code:
    playSound(login_song,1);
    function 
    playSound(a,amount){
    var 
    audio:Sound = new a();
    audio.play(0,amount);


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