src/nu/xero/flex/CanvasView3D.as
/*
00XXXX XXXX00
00XXxx xxXX00
ee0000eeeeRR RReeee0000ee
xxXX00 00XXxx
XXXX00 00XXXX
eexxXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxee
00XXXXeeee00XXXXXXXXXXXX00eeeeXXXX00
xxXXXXXXXX 00XXXXXXXXXXXX00 XXXXXXXXxx
XXXXXXXXXX 00XXXXXXXXXXXX00 XXXXXXXXXX
eeeeXXXXXXXXXXeeeeRRXXXXXXXXXXXXRReeeeXXXXXXXXXXeeee
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXX""""RRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXRR""""XXXX
XXXX 00XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX00 XXXX
XXXX 00XXXX""""""""""""""""""""""""XXXX00 XXXX
XXRR 00XXXX XXXX00 RRXX
eeXX 00xxxxRR000000ee ee000000RRxxxx00 XXee
xxXXXXXXxx xxXXXXXXxx
XXXXXXXXXX XXXXXXXXXX
_____ __ .__
_/ ____\___ _____/ |____ _|__|______ __ __ ______
\ __/ _ \ / \ __\ \/ / \_ __ \| | | ___/
| |( <_> ) | \ | \ /| || | \/| | |___ \
|__| \____/|___| /__| \_/ |__||__| /\____/____ >
\/ \/ \/
. . f l e x . c a n v a s . v i e w . .
*/
package nu.xero.flex
{
import mx.core.*;
import flash.display.*;
import org.papervision3d.view.*;
public class CanvasView3D extends UIComponent
{
private var paperSprite:Sprite;
private var theview:BasicView;
private var theWidth:Number = 0;
private var theHeight:Number = 0;
private var autoScale:Boolean = true;
private var isInteractive:Boolean = false;
private var autoClip:Boolean = true;
private var autoCull:Boolean = true;
public function CanvasView3D()
{
super();
}
override protected function createChildren():void
{
super.createChildren();
paperSprite = new Sprite();
theview = new BasicView(theWidth, theHeight, autoScale, isInteractive);
theview.viewport.autoClipping = autoClip;
theview.viewport.autoCulling = autoCull;
paperSprite.addChild(theview);
addChild(paperSprite);
}
public function set viewWidth(w:Number):void
{
theWidth = w;
theview.viewport.width = theWidth;
}
public function get viewWidth():Number
{
return theWidth;
}
public function set viewHeight(h:Number):void
{
theHeight = h;
theview.viewport.height = theHeight;
}
public function get viewHeight():Number
{
return theHeight;
}
public function set autoScaleMode(bool:Boolean):void
{
autoScale = bool;
theview.viewport.autoScaleToStage = autoScale;
}
public function get autoScaleMode():Boolean
{
return autoScale;
}
public function set interactivity(bool:Boolean):void
{
isInteractive = bool;
//theview.viewport.interactive = isInteractive;
}
public function get interactivity():Boolean
{
return isInteractive;
}
public function set autoClipMode(bool:Boolean):void
{
autoClip = bool;
theview.viewport.autoClipping = autoClip;
}
public function get autoClipMode():Boolean
{
return autoClip;
}
public function set autoCullMode(bool:Boolean):void
{
autoCull = bool;
theview.viewport.autoCulling = autoCull;
}
public function get autoCullMode():Boolean
{
return autoCull;
}
public function get canvas():Sprite
{
return paperSprite;
}
public function get view():BasicView
{
return theview;
}
}
}