Hi,
I'm trying to come up with a dynamic VideoStreamMaterial. I have nine different flvs that I want to play on nine different cubes. As it is now on my site, the video materials appear to be loading all at once. I'd like to have a function that only loads the video if it is selected. Declaring the variables without playing the NetStream throughs an error, which prevents me from making this function dynamic. Can someone guide me in achieving a material that only loads video when it's called? Thanks!
ACTIONSCRIPT:
Actionscript Code:
var netStream1:NetStream = new NetStream(netConnection);
netStream1.play("assets/video/question1.flv");
netStream1.pause();
netStream1.client = customClient;
var video1:Video = new Video(width, height);
video1.attachNetStream(netStream1);
var vMaterial1:VideoStreamMaterial = new VideoStreamMaterial(video1, netStream1);
vMaterial1.precise = true;
vMaterial1.smooth = true;
var netStream2:NetStream = new NetStream(netConnection);
netStream2.play("assets/video/question2.flv");
netStream2.pause();
netStream2.client = customClient;
var video2:Video = new Video(width, height);
video2.attachNetStream(netStream1);
var vMaterial2:VideoStreamMaterial = new VideoStreamMaterial(video1, netStream1);
vMaterial2.precise = true;
vMaterial2.smooth = true;
etc...(for 9 more materials). And this is the videoLoad function that is called after a cube rotation tween.
Actionscript Code:
function videoLoad(n:Number):void
{
activeClip=n-1;
gridBoxArray[activeClip].replaceMaterialByName(this["vMaterial"+n] as VideoStreamMaterial, "back")
var ns:Object=this["netStream"+n] as NetStream;
ns.play("assets/video/question"+n+".flv");
}