Hello Kirupa forums, it’s been a while since I’ve seen you! Seems like everything is going good for you.
I have a little issue that I am facing right now and I am wondering if any of you would know what’s up.
I add an FLVPlayback component on to a Papervision Plan. So far so good. Video plays, 3d works. But I am facing two issues:
-
Even though I set my MovieMaterial to interactive, I canot click on the controls. I have found someone else that stumbled onto something similar (link 1, [URL=“http://www.nabble.com/ISM-Error-with-FLV-component-buttons-td15682804.html#a15682804”]link 2), but since they did not have answer, I though of asking here.
-
The FLVPlayback is jittery. What I mean is that the component’s x position moves all the time from something like 0 to 10 or 20, then back to zero. Remember in the old days of analog television (if you’re old enough) when you had to play with the tracking? It looks like that.
Here is my code:
package
{
// + ----------------------------------------
// [ IMPORTS ]
// + ----------------------------------------
import fl.video.FLVPlayback;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.core.proto.CameraObject3D;
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.materials.MovieMaterial;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.view.Viewport3D;
/**
* @class Main
* @author Mat Janson Blanchet
*/
[SWF(frameRate="30", backgroundColor="#333333")]
public class Main extends Sprite
{
// + ----------------------------------------
// [ CONSTANTS ]
// + ----------------------------------------
// states
// events
// private
// static
// + ----------------------------------------
// [ VARIABLES ]
// + ----------------------------------------
// display objects
// public
// private / protected
private var scene :Scene3D;
private var camera :Camera3D;
private var viewport :Viewport3D;
private var renderer :BasicRenderEngine;
private var videoHolder :Plane;
// static
// + ----------------------------------------
// [ GETTERS / SETTERS ]
// + ----------------------------------------
// + ----------------------------------------
// [CONSTRUCTOR ]
// + ----------------------------------------
public function Main()
{
// set up the stage
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
// Initialise Papervision3D
init3D();
// Create the 3D objects
createScene();
// Initialise Event loop
addEventListener(Event.ENTER_FRAME, pv3DEnterFrameHandler, false, 0, true);
}
// + ----------------------------------------
// [ PUBLIC METHODS ]
// + ----------------------------------------
// + ----------------------------------------
// [ PRIVATE METHODS ]
// + ----------------------------------------
private function init3D():void
{
// create viewport
viewport = new Viewport3D(0, 0, true, false);
addChild(viewport);
// Create new camera with fov of 60 degrees (= default value)
camera = new Camera3D(60);
// initialise the camera position (default = [0, 0, -1000])
/*
camera.x = -100;
camera.y = -100;
*/
camera.z = -400;
// target camera on origin
camera.target = DisplayObject3D.ZERO;
// Create a new scene where our 3D objects will be displayed
scene = new Scene3D();
// Create new renderer
renderer = new BasicRenderEngine();
}
private function createScene():void
{
var videoPlayer:FLVPlayback = new FLVPlayback();
videoPlayer.width = 640;
videoPlayer.height = 480;
videoPlayer.source = "../assets/videos/video.flv";
videoPlayer.skin = "../assets/swf/videoPlayerSkin.swf";
videoPlayer.skinBackgroundColor = 0x333333;
videoPlayer.skinBackgroundAlpha = 0.5;
videoPlayer.autoPlay = true;
var material:MovieMaterial = new MovieMaterial(videoPlayer, false, true);
material.interactive = true;
videoHolder = new Plane(material, 640, 360, 4, 4);
videoHolder.rotationY = -15;
scene.addChild(videoHolder);
}
// + ----------------------------------------
// [ PROTECTED METHODS ]
// + ----------------------------------------
// + ----------------------------------------
// [ EVENT HANDLERS ]
// + ----------------------------------------
private function pv3DEnterFrameHandler(event:Event):void
{
// Render the 3D scene
renderer.renderScene(scene, camera, viewport);
}
}
}
If necessary, I could also post the ActionScript project.
Thank you in advance.