5 Replies Latest reply on Dec 16, 2006 7:33 AM by kglad

    action script to stream 1 file

    IMSTAMU
      I set up the Flash Media Server 2.0 on Windows (test box) under the host dl35.tamu.edu (behind a firewall so I don't mind giving it out)
      Under the applications directory I create a directory called "test"
      Under this directory I place a flash movie called "motion.flv"
      In this same directory I copy the "main.asc" that comes with the Flash 8 software
      I load the "test" application and use "_definst_" as the instance name

      In Flash Professional 8 I create a new fla called "test.fla"
      I embed a movie and use the ClearOverAll.swf as the skin for the movie.
      Under the Paramaters Tab I edit the content path to point to "rtmp:"//dl35.tamu.edu/test/_definst_/motion.flv"
      I test produce the html code and indeed the server shows a connection even though nothing is playing in the browser window.

      Then I do the following;Here is probably where I am most confused but I might have done something wrong with the above as well. I am not a Flash programmer, I am a network guy. All I want to do is the bare minimum in the simplest form of streaming. I could not find code samples that worked including the tutorial on the Adobe site (seems to be fairly common). Digging through other examples I "believe" I found what I wanted but apparantly I did not implement it correctly or it is not what I need after all and I would like someone to verify. The below is the action script that I found that I placed within the test.fla. Is this wrong to do?

      nc = new NetConnection();
      nc.connect("rtmp://dl35.tamu.edu/test/_definst_");

      ns = new NetStream(nc);
      my_video.attachVideo(ns);
      ns.setBufferTime(0);
      ns.play("test");

      Is the above correct? Given the names I have told you, what should be changed? Also does this even need to go here? Is it supposed to be in an action script file all by itself? At any rate when producing this to html (preview) there are several errors:

      **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 16: Statement must appear within on/onClipEvent handler
      nc = new NetConnection();

      **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 17: Statement must appear within on/onClipEvent handler
      nc.connect("rtmp://dl35.tamu.edu/test/_definst_");

      **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 19: Statement must appear within on/onClipEvent handler
      ns = new NetStream(nc);

      **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 20: Statement must appear within on/onClipEvent handler
      my_video.attachVideo(ns);

      **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 21: Statement must appear within on/onClipEvent handler
      ns.setBufferTime(0);

      **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 22: Statement must appear within on/onClipEvent handler
      ns.play("test");

      Total ActionScript Errors: 6 Reported Errors: 6

      Goal: All I want to do is stream 1 file.. just 1. I have no way of knowing whether this server works before taking the next step. It would be nice is Adobe delivered out of the box streaming samples like all of the other streaming servers we support do. But I digress. Any help is will be appreciated beyond any means that I can appropriately convey including a sample code package that works that I can just change a few lines in so I can understand what is happening.