In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

forked from: Papervision3D VideoStreamMaterial Test

// forked from alt's Papervision3D VideoStreamMaterial Test
package
{
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;
        import flash.events.AsyncErrorEvent;
        import flash.events.Event;
        import flash.events.NetStatusEvent;
        import flash.events.SecurityErrorEvent;
        import flash.system.Security;
        
    import org.papervision3d.view.Viewport3D;
    import org.papervision3d.scenes.Scene3D;
    import org.papervision3d.cameras.Camera3D;
    import org.papervision3d.objects.primitives.Plane;
    import org.papervision3d.render.BasicRenderEngine;
        import org.papervision3d.materials.VideoStreamMaterial;

        
    [SWF(width="600", height="600", frameRate="24", backgroundColor="#66CCCC")]
    public class PV3D extends Sprite
    {
        public static const PROXY:String = "http://5ivestar.org/proxy/";
        public static const CROSSDOMAIN:String = "http://5ivestar.org/proxy/crossdomain.xml";
        
        private var viewport:Viewport3D;
        private var scene:Scene3D;
        private var camera:Camera3D;
                private var video_material:VideoStreamMaterial;
        private var plane:Plane; 
        private var renderer:BasicRenderEngine;
                private var _connection:NetConnection;
        private var _stream:NetStream;
        private var _video:Video;
                
                
        public function PV3D():void
        {
            // 
            Security.loadPolicyFile(CROSSDOMAIN);
            
                        // 初期設定
            viewport = new Viewport3D(600, 600, false, true);
            addChild(viewport);
            scene = new Scene3D();
            camera = new Camera3D();
            renderer = new BasicRenderEngine();
            
                        // 
                        _connection = new NetConnection();
                        _connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                        _connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            _connection.connect( null );
            _stream = new NetStream( _connection );
                        _stream.client = this;
                        _stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
                        _stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
            _video = new Video();
            _video.attachNetStream( _stream );
            _stream.play( PROXY + "http://blog.alt-scape.com/swf/fullscreen.flv" );
                        
                        //
                        var vsm:VideoStreamMaterial = new VideoStreamMaterial( _video , _stream );
            vsm.doubleSided = true;
            plane = new Plane(vsm, 1200, 800, 3, 3);
            scene.addChild(plane);
            
            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
                private function onEnterFrame(e:Event):void
            {
            plane.rotationY += 2;
            renderer.renderScene(scene, camera, viewport);
        }
                private function netStatusHandler(event:NetStatusEvent):void
                {
                }
                private function securityErrorHandler(event:SecurityErrorEvent):void
                {
                    trace(this + event);
                }
                private function asyncErrorHandler(event:AsyncErrorEvent):void
                {
                    trace(this + event);
                }
                public function onMetaData(param:Object):void
                {
                }
    }
}