A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: Attaching external FLV to Video Object via AS

  1. #1
    Junior Member
    Join Date
    Feb 2008
    Posts
    10

    Attaching external FLV to Video Object via AS

    I've been reading a few articles, and they are all suggesting that this is done in just a certain way, and they all seem to be uniform in the way that they are explaining how to do this (probably because most of them are from Adobe), but i cannot seem to get this one working...

    In my time line i have a Video object with an instance name of "myVideo", and in that same frame, but in my actions layer, i have the following code that is supposed to load the video from the same folder as the swf:
    PHP Code:
    var nc:NetConnection = new NetConnection();

    nc.connect(null);

    var 
    ns:NetStream = new NetStream(nc);

    myVideo.attachVideo(ns);

    ns.play("Video-1.flv"); 
    But when you get to this spot, there is no video... I am including a screenshot of the timeline and action script to see if it helps...
    Attached Images Attached Images

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    173
    Hi Alex,

    Try Using this code in the timeline script replacing yours -

    // Create a NetConnection object
    var netConn:NetConnection = new NetConnection();
    // Create a local streaming connection
    netConn.connect(null);
    // Create a NetStream object and define an onStatus() function
    var netStream:NetStream = new NetStream(netConn);
    netStream.onStatus = function(infoObject) {
    status_txt.text += "Status (NetStream)" + newline;
    status_txt.text += "Level: "+infoObject.level + newline;
    status_txt.text += "Code: "+infoObject.code + newline;
    };
    // Attach the NetStream video feed to the Video object
    my_video.attachVideo(netStream);
    // Set the buffer time
    netStream.setBufferTime(5);
    // Begin playing the FLV file
    netStream.play("video/yourvideo.flv");


    Also,
    The Video in your stage is having an instance name of "my_video"


    Hope this helps!
    Even if does not let me know I will something else for you.


    Thanks
    Kallol

  3. #3
    Junior Member
    Join Date
    Feb 2008
    Posts
    10
    Thanx, but this is the same code that i was using, except that you are using a buffer and an onStatus event handler. Are you suggesting that one, or both of those are required? I will try it anyway, as i may just be overlooking something, thanx.

    Will report back momentarily...

  4. #4

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