页: 1
I ve tried to get it working with a MovieAssetMaterial, no luck.
If I trace the stage inside a MovieAssetMaterial, the stage is null, and I m guessing that s why the scrollpane wouldn t behave properly. It s a container, therefore it needs the stage to set itself up properly.
我已设法在纸张平面上获得一个滚动灯200x200,与工作范围的互动。 我的守则如下:
package{
import org.papervision3d.*;
import org.papervision3d.view.*;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.scenes.*;
import org.papervision3d.render.*;
import flash.display.*;
import flash.events.*;
import fl.controls.*;
import fl.containers.*;
public class PV3DScrollPane extends MovieClip{
private var viewport:Viewport3D;
private var camera:Camera3D;
private var scene:Scene3D;
private var renderer:BasicRenderEngine;
private var plane:Plane;
public function PV3DScrollPane(){
init3D();
}
private function init3D():void
{
//setup 3d
viewport = new Viewport3D(1024, 768, false, true);
addChild(viewport);
camera = new Camera3D();
camera.z = -500;
camera.zoom = 1;
camera.focus = 500;
camera.target = DisplayObject3D.ZERO;
scene = new Scene3D();
renderer = new BasicRenderEngine();
//setup plane
plane = makePlane();
stage.addEventListener(Event.ENTER_FRAME, loop);
}
public function makePlane():Plane
{
//setup scroll pane
var sp:ScrollPane = new ScrollPane();
addChild(sp);
sp.x = 1000;//hide it off stage, visible doesn t help much
sp.source = http://www.helpexamples.com/flash/images/image1.jpg ;
sp.setSize(200, 200);
//setup material & plane
var mat:MovieMaterial = new MovieMaterial(sp, false, true, false);
mat.interactive = true;
var plane:Plane = new Plane(mat, 0, 0, 10, 10);
scene.addChild(plane);
return plane;
}
private function loop(evt:Event):void
{
//plane.rotationY++;
renderer.renderScene(scene, camera, viewport);
}
}
}
And the explanations:
I ve tried using BasicView, but I couldn t get the same results so I used the oldschool way of creating the scene,camera, rendered and viewport.
Since ScrollPane needs the stage, I ve added it to the stage then set its size.
The I ve created a MovieMaterial using the ScrollPane, and set its interactivity to true.
I ve hidden the component by placing off stage. Setting visible to false got me back to the 100x100 issue.
我只字眼,因为我记得用来用纸张开展工作的“倡议”组成部分。 确实如此, used <>strong> to work. Here? 还有一个类似的员额。 你们可以找到交互式的MovieMaterial。 如同你为之奋斗一样,但与目前的纸面版本不合作,因为再没有一种灵丹妙药。 在我作定本后,我在约翰·格登斯网站上找到了一个新职位(2008年)。 这种做法是相似的,但我并没有处理所有这种麻烦。
希望这一帮助!