hi how to access spring camera methods and parametr when my class extends from basi view
package {
import flash.display.DisplayObject;
import flash.display.InteractiveObject;
import flash.display.Loader;
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.net.URLRequest;
import flash.ui.Keyboard;
import org.papervision3d.cameras.CameraType;
import org.papervision3d.core.math.Number3D;
import org.papervision3d.core.proto.MaterialObject3D;
import org.papervision3d.events.InteractiveScene3DEvent;
import org.papervision3d.materials.BitmapFileMaterial;
import org.papervision3d.materials.ColorMaterial;
import org.papervision3d.materials.MovieMaterial;
import org.papervision3d.objects.DisplayObject3D;
import org.papervision3d.objects.primitives.Cylinder;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.view.BasicView;
import flash.text.*
/**
* ...
* @author vahid
* @serial
*/
public class MyCarousel extends BasicView {
private var continer_3d:DisplayObject3D
private var cylinder:Cylinder
private var num_vertic:Number;
private var i:Number = 0;
private var plane:Plane
private var thumb_width:Number = 75;
private var thumb_height:Number = 75;
protected var material:ColorMaterial;
protected var color:Number;
private var num:Number = 0
private var focus_txt:TextField
private var keyRight:Boolean;
private var keyLeft:Boolean;
private var keyForward:Boolean;
private var keyBackward:Boolean;
public function MyCarousel(){
super(800, 600, true, true, CameraType.SPRING)
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.frameRate = 40;
init()
startRendering();
}
protected function init():void {
continer_3d = new DisplayObject3D()
scene.addChild(continer_3d)
cylinder = new Cylinder(null, 250, 180, 15, 2)
num_vertic = cylinder.geometry.vertices.length
for (i; i < num_vertic; i++){
//getMaterial ()
plane = new Plane(getMaterial(), thumb_width, thumb_height, 1, 1)
plane.x = cylinder.geometry.vertices[i].x
plane.y = cylinder.geometry.vertices[i].y
plane.z = cylinder.geometry.vertices[i].z
plane.localRotationY = -Math.atan2(plane.x, plane.z) * 180 / Math.PI;
plane.addEventListener(InteractiveScene3DEvent.OBJECT_PRESS, objectRollOver)
continer_3d.addChild(plane)
camera.z -= 1000
camera.lookAt(plane)
}
viewport.interactive = true;
this.addEventListener(MouseEvent.MOUSE_WHEEL, wheelFun, true, 10, true)
trace(camera.focus)
focus_txt = new TextField()
focus_txt.x = stage.stageWidth / 2
focus_txt.y = stage.stageHeight - 100
addChild(focus_txt)
stage.focus = focus_txt as InteractiveObject
viewport.containerSprite.stage.addEventListener(KeyboardEvent.KEY_DOWN, funDKeyboard)
viewport.containerSprite.stage.addEventListener(KeyboardEvent.KEY_UP, funUKeyboard)
viewport.containerSprite.stage.addEventListener(Event.ENTER_FRAME, moveObject)
}
protected function funUKeyboard(e:KeyboardEvent):void {
var key:int = e.keyCode
switch (key){
case Keyboard.UP:
keyForward = false
break;
case Keyboard.DOWN:
keyBackward = false
break;
case Keyboard.LEFT:
keyLeft = false
break;
case Keyboard.RIGHT:
keyRight = false
break;
}
}
protected function funDKeyboard(e:KeyboardEvent):void {
var key:int = e.keyCode
switch (key){
case Keyboard.UP:
keyForward = true
break;
case Keyboard.DOWN:
keyBackward = true
break;
case Keyboard.LEFT:
keyLeft = true
break;
case Keyboard.RIGHT:
keyRight = true
break;
}
}
protected function moveObject(e:Event):void {
if (keyForward){
continer_3d.moveForward(30);
} else if (keyBackward){
continer_3d.moveBackward(30);
}
if (keyRight){
continer_3d.moveRight(30);
} else if (keyLeft){
continer_3d.moveLeft(30)
}
}
protected function wheelFun(e:MouseEvent):void {
if (e.delta > 0){
num += .1
} else {
num -= .1
}
camera.zoom += num
trace(num)
focus_txt.text = String(num)
}
protected function getMaterial():ColorMaterial {
material = new ColorMaterial(getRandomeNumber(), 1, true)
material.doubleSided = true
return material
}
protected function getRandomeNumber():Number {
color = Math.random() * 0xFFFFFF
return color
}
protected function objectRollOver(e:InteractiveScene3DEvent):void {
}
override protected function onRenderTick(e:Event = null):void {
//continer_3d.z += 3
// trace("camera X : " + camera.x, "camera Y : " + camera.y, "camera Z : " + camera.z)
// trace("camera X R: " + camera.rotationX, "camera Y R: " + camera.rotationY, "camera Z R: " + camera.rotationZ)
continer_3d.localRotationY += (stage.mouseX - stage.stageWidth / 2) / 200;
super.onRenderTick();
}
}
}