A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: how can I get my video to pause on the first frame?

Hybrid View

  1. #1
    Vaster Graphics
    Join Date
    Jun 2006
    Posts
    165

    how can I get my video to pause on the first frame?

    Hey,
    I asked a question earlier on the message board but I have since found most my answers except for one. How can I get a video in a custom player to pause on the first frame? This way the user doesn’t have to watch the video until they are ready BUT the image is there instead of white or black. Thanks in advance for any help. Oh and I’ve pasted my code if it helps.

    //---Net Connection Setup---\\

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

    //---Net Stream Setup---\\

    var ns:NetStream = new NetStream(nc);



    ns.onMetaData = function(info) {
    ns.duration = info.duration;
    }



    //---Attaching Net Stream---\\

    video.attachVideo(ns);

    //---Playing External FLV---\\


    ns.play("movie.flv");


    //---Loop External FLV---\\


    ns.onStatus = function(info) {
    if (info.code == "NetStream.Play.Stop") {
    ns.seek(0);
    }
    };


    //---Button Function---\\


    playPause_mc.onRollOver = function() {
    ns.pause(false);
    }

    playPause_mc.onRollOut = function() {
    ns.pause(true);
    }

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    PHP Code:
    // on stage -
    // nsMov - Video object
    // play_btn - Button component

    var ns:NetConnection = new NetConnection (); 
    ns.connect (null); 
    var 
    nsStream:NetStream = new NetStream (ns);
     
    nsStream.onStatus = function (infoObject){ 
    trace (infoObject.code); 
    if (
    infoObject.code == "NetStream.Play.Start"){
    this.seek (1); 
    this.pause();

    };
     
    nsMov.attachVideo (nsStream); 
    nsStream.setBufferTime(1); 
    nsStream.play("w50s.flv"); 

    var 
    Obj:Object = new Object();
    Obj.click = function(eventObj:Object){
    nsStream.pause();
    };
    play_btn.addEventListener("click"Obj); 
    hth

  3. #3
    Vaster Graphics
    Join Date
    Jun 2006
    Posts
    165
    Hey,

    Thanks for the help. I've got the movie to load and pause but the roll over functions doesn't work. Was the code

    var Obj:Object = new Object();
    Obj.click = function(eventObj:Object){
    nsStream.pause();
    };
    play_btn.addEventListener("click", Obj);

    supposed to do that? I tried putting a button and an MC on the timeline with the instance name of play_btn but niether cause anything to happen. Any ideas? Thanks for the help

  4. #4
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    // play_btn - Button component
    used to start/pause the movie

    for a simple button -

    my_button.onRollOver = function(){
    nsStream.pause();
    };

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