A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: HELP! sound object stop kills flv sound too

  1. #1
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    HELP! sound object stop kills flv sound too

    code:

    if (!firstTime) {
    _root.introMusic = new Sound();
    _root.introMusic.attachSound("music");
    _root.introMusic.setVolume(50);
    _root.introMusic.start(0, 1);
    firstTime = true;
    }

    music_btn.onRelease = function() {
    if (!rockNow) {
    _root.introMusic.setVolume(0);
    this.gotoAndStop(2);
    rockNow = true;
    } else {
    _root.introMusic.setVolume(50);
    this.gotoAndStop(1);
    rockNow = false;
    }
    };
    stop();



    This script for my "music on/off" btn kills ALL audio and not just the sounds object audio. It also pauses FLV playback (I'm using the FLVplayback component). Any insite?

    I've tried modifying the above AS not using the "_root." to target the obj and also stop() and start() on the obj instead of just volume control. HELP!!!

    Thanks,
    1M.

  2. #2
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    add (this) to your Sound declaration:
    Code:
    if (!firstTime) {
    
    	_root.introMusic = new Sound(this);
    
    	_root.introMusic.attachSound("music");
    
    	_root.introMusic.setVolume(50);
    
    	_root.introMusic.start(0, 1);
    
    	firstTime = true;
    
    }

  3. #3
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    still no love

    I tried that and even switched "this" to "_root" and it still didn't work. The "music off" btn still mutes all FLVs.

    Help!
    Thanks,
    1M.

  4. #4
    http://pat.theorigin.net cresquin's Avatar
    Join Date
    Jun 2003
    Location
    Los Angeles, CA
    Posts
    685
    you changed your first line to look like this?

    Code:
    _root.introMusic = new Sound(this);

  5. #5
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439
    indeed, I did. I'm attempting to load the MP3 externally and forgo the 'attachSound' function.
    ... The "_root.introMusic = new Sound(this);" didn't fix the issue at present....

    Thanks,
    1M.

  6. #6
    AFX == P. Forsberg
    Join Date
    Nov 2001
    Posts
    439

    kill the attachSound

    I switched my code to call the sound external and it now works.
    code:

    if (!firstTime) {
    _root.introMusic = new Sound();
    _root.introMusic.onLoad = function(success:Boolean) {
    if (success) {
    _root.introMusic.start();
    _root.introMusic.setVolume(50);
    } else {
    trace("Sound failed");
    }
    };
    _root.introMusic.loadSound("music.mp3", true);
    firstTime = true;
    }
    stop();
    music_btn.onRelease = function() {
    if (!rockNow) {
    _root.introMusic.setVolume(0);
    this.gotoAndStop(2);
    rockNow = true;
    } else {
    _root.introMusic.setVolume(50);
    this.gotoAndStop(1);
    rockNow = false;
    }
    };



    I hate not finding the proper solution, but I like meeting deadlines more.

    Thanks,
    1M.

  7. #7
    Junior Member
    Join Date
    Jun 2007
    Location
    Beijing,China
    Posts
    13
    you can try this:
    var mc = _root.createEmptyMovieClip("mc",1);
    _root.introMusic = new Sound(mc);
    My English is poor...

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