A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: removing audio from background

  1. #1
    Member
    Join Date
    Sep 2007
    Posts
    60

    removing audio from background

    i am trying to remove my sound from background...

    for some reason keep getting this error

    Error: Error #2029: This URLStream object does not have a stream opened.
    at flash.media::Sound/close()
    at Soundbox/killAudio()
    at Buttons/onClick()


    i hope this doesnt become too much so bear with me please..
    this is my document class...

    package
    {
    import flash.display.MovieClip;
    import Buttons;

    public class Dominara extends MovieClip
    {
    public var s:Soundbox = new Soundbox(); //this calls onto your sound class which loads the sorrow music
    public function Dominara()
    {
    var btnClass:Buttons = new Buttons(exit_btn,credits_btn,options_btn,continue_ btn,newgame_btn);
    s.playMain();
    }
    }
    }
    now this is my sound class where i call upon to load the music...

    package
    {
    import flash.media.Sound;
    import flash.media.SoundLoaderContext;
    import flash.net.URLRequest;

    public class Soundbox extends Sound
    {
    private var playsound:Sound = new Sound();
    private var loadmusic:URLRequest = new URLRequest("sorrow.mp3");
    private var context:SoundLoaderContext = new SoundLoaderContext(8000, true);

    public function Soundbox()
    {
    trace("working");
    }

    public function playMain()
    {
    playsound.load(loadmusic, context);
    playsound.play(0,20); //this will repeat the soundtrack x amount of times
    }

    public function killAudio()
    {
    playsound.close();
    }
    }
    }
    as can see i added or thought it would help the killaudio function ....


    now finally i want to be able to press this button and in it as its pressed it closes or removes the audio...
    public function onClick(event:MouseEvent):void
    {
    ruut.gotoAndStop(4);
    ruut.s.killAudio();
    }
    what should i place in my function to close the audio or kill it....

  2. #2
    Member
    Join Date
    Sep 2007
    Posts
    60
    solved it

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