A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Dynamic VideoStreamMaterial in Papervision?

  1. #1
    Junior Member
    Join Date
    Apr 2006
    Posts
    20

    Question Dynamic VideoStreamMaterial in Papervision?

    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");
    }
    Last edited by pajhonka; 03-02-2010 at 04:13 PM.

  2. #2
    Junior Member
    Join Date
    Apr 2006
    Posts
    20
    When I try something like this:
    Actionscript Code:
    function videoLoad(n:Number):void
    {
        activeClip=n-1;
        var nsString:String = ("assets/video/question"+n+".flv");
        var video:Video = new Video();
        var conn:NetConnection = new NetConnection();
        conn.connect(null);
        var stream:NetStream = new NetStream(conn);
        video.attachNetStream(stream);
        var material:VideoStreamMaterial = new VideoStreamMaterial (video, stream);
        material.animated = true;
        stream.play(nsString);
        gridBoxArray[activeClip].replaceMaterialByName(material, "back")


    I get the following error:
    SecurityError: Error #2123: Security sandbox violation: BitmapData.draw: file:///MacintoshHD/Users/pajhonka/Sites/main/about.swf cannot access null. No policy files granted access.
    at flash.display::BitmapData/draw()
    at org.papervision3d.materials::MovieMaterial/drawBitmap()
    at org.papervision3d.materials::MovieMaterial/createBitmapFromSprite()
    at org.papervision3d.materials::MovieMaterial/set texture()
    at org.papervision3d.materials::MovieMaterial()
    at org.papervision3d.materials::VideoStreamMaterial()
    at about_fla::MainTimeline/videoLoad()
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at com.greensock.core::TweenCore/complete()
    at com.greensock::TweenLite/renderTime()
    at com.greensock.core::SimpleTimeline/renderTime()
    at com.greensock::TweenLite$/updateAll()

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center