It's not in the adobe documentation, but when you are extending you have to declare inspectables slightly differently.
ie. [Inspectable(name="orientToFocus", variable="orientToFocus", type="Boolean", defaultValue="false")] and they have to go before the class definition. Mine weren't showing up until i declared in this way. maybe thats the issue?
as for the camera class, well there is nothing in it at the moment except for an onEnterframe routine that does some automated camera panning/zooming, you could pass in any sprite or entity as the focusOn argument and it if orientToFocus was enabled it would use that as a 'camera' just like you were planing
here is my camera
Code:
public class Camera extends Entity
{
public function Camera(){
this.addEventListener(Event.ENTER_FRAME,enterFrame);
}
private var n:Number=0;
private function enterFrame(e:Event):void
{
//move the cam and make it loop back to origin
this.y = 225 + Math.sin(n)*225;
this.scaleX = 3 + Math.sin(n)*3;
this.scaleY = 3 + Math.sin(n)*3;
this.rotation = (n / 8)*30;
n+=0.05;
}
}
here is my subclass of World
Code:
[Inspectable(name="orientToFocus", variable="orientToFocus", type="Boolean", defaultValue="false")]
public class DWorld extends World {
public var orientToFocus:Boolean;
...
public override function scrollRotation():Number {
//if orient to gravity set, do rotations of the world based on gravity
if(orientToGravity) {
var b:BodyShape = focus as BodyShape;
var g:V2 = getGravityFor(V2.fromP(pos).divideN(scale), b ? b.b2body : null, b);
return (Math.atan2(g.y, -g.x) * Util.R2D) - 90;
}
//if orient to focus set, manipulate the world based on the properties of the focus object (ie. the camera)
if(orientToFocus) {
scaleX = focus.scaleX;
scaleY = focus.scaleY;
return focus.rotation;
}
//else just return standard rotation
return rot;
}
}