A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: How to stop FLV audio playback on navigation

  1. #1
    Junior Member
    Join Date
    Jul 2007
    Posts
    19

    How to stop FLV audio playback on navigation

    So my FLV videos play just fine, however when I click on any of the navigation buttons to visit another section of my website, the audio keeps on going. There must be some simple AS to stop the audio once a button is clicked. As it is now, the user has to stop the FLV video manually by clicking the stop button on the FLV playback component. I am using AS3, thanks for viewing and for any input.

  2. #2
    ___________________
    Join Date
    May 2004
    Posts
    3,174
    have you tried FLVPlayback.stop()?

  3. #3
    Junior Member
    Join Date
    Jul 2007
    Posts
    19
    So I tried FLVPlayback.stop(); and placed it in the AS of one of my navigation buttons. I got the following error when I exported my page:

    "Call to a possibly undefined method stop through a reference with static type Class"

    Here is my AS:

    function onIllustrationClick(evt:MouseEvent):void {
    gotoAndStop("Illustration");
    FLVPlayback.stop();
    }
    illustration_btn.addEventListener(MouseEvent.CLICK , onIllustrationClick);

    Again, all I want to do is have the FLV videos stop playing in the background once I click this navigation button. Any other ideas?

  4. #4
    Junior Member
    Join Date
    Jul 2007
    Posts
    19
    Alright, I got it to work and now I understand what you meant. I just needed to replace FLVPlayback with the instance name of the movie. That was way to easy for all the trouble it has caused me. Now my AS looks like this.....

    function onIllustrationsClick(evt:MouseEvent):void {
    movie_1.stop();
    gotoAndStop("Illustrations");

    }
    illustrations_btn.addEventListener(MouseEvent.CLIC K, onIllustrationsClick);

    Thanks for the help

  5. #5
    ___________________
    Join Date
    May 2004
    Posts
    3,174

  6. #6
    Junior Member
    Join Date
    Jul 2009
    Posts
    1
    I'm having the same problem using actionscript 2.0...will that same FLVPlayback.stop(); work in there as well? If not what would be a/the solution? I've been looking all over the internet, checking out books I have as well as books from book stores and I haven't found anything.

    If that stop function (if it's called a function) will work, do I put it in the actions on a navigation button, or the actions on each of my videos? Whichever one I put it on, where in the code to I place it (so I don't break the code)?

    I created a custom video player, loading external .flv's through a tutorial from gotoandlearn.com and this is the actionscript on my video & player:

    var nc:NetConnection = new NetConnection();
    nc.connect(null);

    var ns:NetStream = new NetStream(nc);

    ns.setBuferTime(30);

    ns.onStatus = function(info){
    if(info.code == "NetStream.Buffer.Full"){
    bufferClip._visible = false
    }
    if(info.code == "NetStream.Buffer.Empty"){
    bufferClip._visible = true
    }
    if(info.code == "NetStream.Play.Stop"){
    ns.seek(0);
    }
    }
    demoReel.attachVideo(ns);

    ns.play("DemoReel_ACTING.flv");

    rewindButton.onRelease = function(){
    ns.seek(0);
    }

    playpauseButton.onRelease = function(){
    ns.pause();
    }

    var videoInterval = setInterval(videoStatus,100);
    var amountLoaded:Number;
    var duration:Number;

    ns["onMetaData"] = function(obj){
    duration = obj.duration;
    }

    function videoStatus(){
    amountLoaded = ns.bytesLoaded / ns.bytesTotal;
    loader.loadBar._width = amountLoaded * 361.6;
    loader.scrub._x = ns.time / duration * 361.6;
    }

    var scrubInterval;

    loader.scrub.onPress = function(){
    clearInterval(videoInterval);
    scrubInterval = setInterval(scrubit,10);
    this.startDrag(false,0,this._y,362,this._y);
    }

    loader.scrub.onRelease = loader.scrub.onReleaseOutside = function(){
    clearInterval(scrubInterval);
    videoInterval = setInterval(videoStatus,100);
    this.stopDrag();
    }

    function scrubit(){
    ns.seek(Math.floor((loader.scrub._x/362)*duration));
    }

    Any and all help with this is appreciated. I've been working on my site for a good month now—probably would've been sooner but I keep running into similar problems; this is the worst one yet.

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