jaga
01-23-2008, 05:54 PM
I'm retooling my physics engine with interfaces in order to use better OOP practices, and I've run into what I think is a simple hitch, but I can't quite figure out.
I have an interface IPhysicsEntity.as
package PhysicsSystem {
public interface IPhysicsEntity {
function physicsUpdate():void;
}
}
and I have a function in another location:
public function addObject(whichObject:IPhysicsEntity):void {
objectArray.push(whichObject);
}
and I'm passing into the addObject function something that implements IPhysicsEntity..
import PhysicsSystem.IPhysicsEntity;
public class PhysicsObject extends Sprite implements IPhysicsEntity {
/// et cetera
and I'm getting the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert PhysicsObject@3135791 to PhysicsSystem.IPhysicsEntity.
Am I doing something obviously wrong?
I have an interface IPhysicsEntity.as
package PhysicsSystem {
public interface IPhysicsEntity {
function physicsUpdate():void;
}
}
and I have a function in another location:
public function addObject(whichObject:IPhysicsEntity):void {
objectArray.push(whichObject);
}
and I'm passing into the addObject function something that implements IPhysicsEntity..
import PhysicsSystem.IPhysicsEntity;
public class PhysicsObject extends Sprite implements IPhysicsEntity {
/// et cetera
and I'm getting the following error:
TypeError: Error #1034: Type Coercion failed: cannot convert PhysicsObject@3135791 to PhysicsSystem.IPhysicsEntity.
Am I doing something obviously wrong?