Skip to main content
January 7, 2007
Question

attachMovie and attachVideo question

  • January 7, 2007
  • 1 reply
  • 301 views
Hello everyone,

I have looked at some tutorials and realised that they have used the following actionScript to play a movie:

attachMovie("FLVPlayback", "my_FLVPlybk", 10, {width:320, height:240, x:90, y:100});

I was wonuder if it is possible to replace this line of script with something which uses :

theVideo.attachVideo();

If this is possible, could you tell me how the script should be for it?

Thank you very much for your help and have a great day.

Babak 🐵
    This topic is closed to new replies. Start a new post to keep the conversation going.

    1 reply

    Participating Frequently
    January 8, 2007
    The attachMovie appears to using the Flash 8 Professional FLVPlayback component found in the components panel. The developer choose not to place it on stage and rather create it dynamically.

    If you want to simply connect to a FMS (Flash Media Server) and play a vide here is the skeleton code:

    nc = new NetConnection();
    nc.onStatus = function(info){
    trace("nc.onStatus - info.code: " + info.code);

    if (this.isConnected){
    trace("nc.onStatus - this.isConnected");
    stream = new NetStream(nc);
    stream.setBufferTime(2);


    vid_video.attachVideo(stream); // vid_video is a Video symbol instance on stage
    stream.play("FLVName", 0); // No .flv. Ex:myVideo.flv is myVideo
    }

    }
    nc.connect("rtmp://your.rtmphost.com/_definst_");



    If you want to play a flv file (progressive download) here is the skeleton code:
    var vid_video:Video;
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var stream:NetStream = new NetStream(nc);
    stream.setBufferTime(2);
    vid_video.attachVideo(stream);
    stream.play("myVideo.flv");