1 Reply Latest reply on Jan 30, 2008 4:50 PM by Damon Edwards

    Coding with Strict Type Fails

    rocknbill
      why doesn't my ActionScript work in strict? All of the samples in the help files are coded this way, and I feel like I'm missing something.

      Here's an example. Most of the code you see on the web for importing external video is as follows:

      var nc :NetConnection = new NetConnection();
      nc.connect(null);
      var ns :NetStream = new NetStream(nc);
      my_video.attachVideo(ns);
      ns.play("sample.flv");

      Which I cannot get to work. However, this works fine:

      var nc = new NetConnection();
      nc.connect(null);
      var ns = new NetStream(nc);
      my_video.attachVideo(ns);
      ns.play("sample.flv");

      Another example, from the CS3 help files:

      function pauseHandler(event:MouseEvent) :void
      {
      ns.pause();
      }

      Always returns an error, I have to remove :void:
      function pauseHandler(event:MouseEvent)
      {
      ns.pause();
      }

      The above is true for testing within Flash or in deployed files. I spent hours figuring out why my samples don't work, now if I could understand the why behind the why . . . . :-)