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.

About Harry

I am a 16 year old web designer/developer and I love any form of interactive media.
This entry was posted in 3D, Experimental, Flash and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create