views:

405

answers:

2

I have a blank project that simply plays two video files. No matter what I try, the second video gets sized to the same as the first. Please tell me this isn't a Flash bug and that there's something I can do to accomplish this. Here's my document class:

package{

    import flash.display.*;
    import flash.media.*;
    import flash.net.*;

    public class Test extends MovieClip{

     public function Test(){

      var nc = new NetConnection();
      nc.connect(null);
      var ns = new NetStream(nc);
      var vid1 = new Video(120, 88);
      vid1.x = 100;
      vid1.y = 300;
      this.addChild(vid1);

      vid1.attachNetStream(ns);
      ns.client = new Object();
      ns.play("video/testvideo1.flv"); 


      var ns2 = new NetStream(nc);
      var vid2 = new Video(600,678);
      vid2.x = 500;
      vid2.y = 50;
      this.addChild(vid2);

      vid2.attachNetStream(ns2);
      ns2.client = new Object();
      ns2.play("video/testvideo2.flv");


     }
    }
}

If you trace out the size of vid2 immediately after you create it at (600,768), it says (120,88) - the size of the first video.

A: 

If there is no special reason both videos have to play within the same SWF, you could just host both videos as separate SWFs in a single HTML page. If you need some coordination between them, you can write a JavaScript bridge easily for this, using ExternalInterface.

Warren Young
Maybe even separated Movie Clips inside the Flash Movie may work.
Havenard
A: 

Take a look at this blogpost: http://synja.com/?p=14

Apparently you just have to specify the width and height after initialization. So:

var vid1 = new Video(120, 88);
vid1.width = 120;
vid1.height = 88;

[...]

var vid2 = new Video(600,678);
vid2.width = 600;
vid2.height = 678;
Jamie Appleseed