Ok. I am stumped. I am working through subject book. I am in Chapter 6. In the author’s first example where we are drawing 3D vector shapes, I am running into a Flash Compiler error #1061 (call to undefined method). I am having problems where we use “offset” to push the vector shapes along the x-axis so that both of them are seen side-by-side. If I comment out both lines where we develop the shape of each (triangle and square), I get both shapes accordingly. I am using the latest sdk from away3d and Flash CS5.5 is my IDE. Did away3d move the offset function somewhere else???
Here is the vector shape class:
package {
import away3d.core.base.*;
import away3d.materials.*;
[SWF(width="800", height="600")]
public class SimpleVectorShapes extends SampleBase {
override protected function _createScene():void {
var mesh:Mesh = new Mesh();
mesh.bothsides = true;
var material:WireColorMaterial = new WireColorMaterial(0xFF0000);
material.wireColor = 0x000000;
material.thickness = 2;
mesh.material = material;
_view.scene.addChild(mesh);
// TRIANGLE object
var face0:Face = new Face();
face0.moveTo(-50, -50, 0);
face0.lineTo(50, 50, 0);
face0.lineTo(-50, 50, 0);
face0.lineTo(-50, -50, 0);
face0.offset(-300, 0, 0);
mesh.addFace(face0);
// SWUARE object
var face1:Face = new Face();
face1.moveTo(-50, -50, 0);
face1.lineTo(50, -50, 0);
face1.lineTo(50, 50, 0);
face1.lineTo(-50, 50, 0);
face1.lineTo(-50, -50, 0);
//face1.offset(-180, 0, 0);
mesh.addFace(face1);
}
}
}
and here is the base class:
package {
import away3d.cameras.*;
import away3d.containers.*;
import flash.display.*;
import flash.events.*;
[SWF(width="800", height="600")]
public class SampleBase extends Sprite {
protected var _camera:Camera3D;
protected var _view:View3D;
public function SampleBase() {
_createView();
_createScene();
}
protected function _createView():void {
_camera = new TargetCamera3D();
_camera.z = -1000;
_view = new View3D();
_view.x = 400;
_view.y = 300;
_view.camera = _camera;
addChild(_view);
addEventListener(Event.ENTER_FRAME, _onEnterFrame);
}
protected function _createScene():void {
}
protected function _onEnterFrame(ev:Event):void {
_camera.x -= (_camera.x - (3 * (mouseX - (stage.stageWidth / 2)))) / 4;
_camera.y -= (_camera.y + (2 * (mouseY - (stage.stageHeight / 2)))) / 4;
_view.render();
}
}
}
I moved from PV3D to Away3D cuz Away3D is more updated and active. Plus I am trying to convince my company about using 3D objects in the training we develop for our clients. Any help on my error above would greatly be appreciated.
Tony