Away3D Base Class
In my effort to cut down the amount of code I write when using Away3D, I created this. It is a base class for projects using Away3D. What this does is create a series of protected functions that you can override and add in what you need, while the base class created the viewport, scene and everything else! This minimizes the amount of code you write in the actual project to a minimal amount!
Here is an example:
package { import away3d.primitives.Sphere; import com.harrynorthover.base.AwayBase; public class BaseClass extends AwayBase { public var sphere:Sphere = new Sphere( { radius:100 } ); public function BaseClass() { // Init(camZoom, viewX, viewY); Init(12, 0, 0); } override protected function Init3D():void { sphere.x = 0; sphere.y = 0; view.scene.addChild(sphere); } } }
See how much is has been reduced by? No faffing around with View3D and addChild(view) etc.
You can download the whole thing here: http://harry-northover-code-store.googlecode.com/files/Away3dBase.zip
Hope it helps!
Harry.








0 comments
Kick things off by filling out the form below.
Leave a Comment