If you are coding this in an Actor subclass, you cannot directly use 'getWidth' (or 'getHeight'). You need to execute those methods on a World object. The Actor class API has a method that returns the world it is in.
To elaborate, all non-static methods are executed on an object. If the object is not explicitly given, it is executed on the object that the 'this' keyword would refer to. In a World subclass, 'this' refers to a specific world of that class the method resides in; in anActor subclass, 'this' refers to a specific actor of that class the method resides in.