I think I broke my Flash. I’m using Flash CS5.5, and when I use AS3, any references to the Math class give me errors like this:
1061: Call to a possibly undefined method sqrt through a reference with static type Class.
1061: Call to a possibly undefined method pow through a reference with static type Class.
1061: Call to a possibly undefined method pow through a reference with static type Class.
The code in error is this:
var dist:Number = Math.sqrt(Math.pow(initPos.x - pos.x, 2) + Math.pow(initPos.y - pos.y, 2));
What the heck is going on here? Math is a top-level class, so I don’t think I should be getting an error like this. Is it possible to somehow “break” the Math class? If so, how do I fix it?
Edited from discussion below
The compiler error reference says that “You are calling a method that is not defined.”
Mathnot being defined sounds pretty serious – if you have no idea of why this occurred, maybe reinstall your SDK?Original answer:
Does other Actionscript work for you? Is it only the
Mathclass that is broken for you? If others are broken too, it’s probably a build path configuration issue.If not, check to make sure that you don’t have any class named
Mathin the package that might interfere.