im converting a load of my old AS2 classes into AS3 and im having problems with this one class i have. It is a class full of custom math functions, and all they do is they use the numbers given to them, and return a new value. simple. And it worked fine in AS2. but for some reason AS3 doesnt like it.
This is basically what ive done:
package
{
public class Math2
{
public function randRange(l:Number, h:Number):Number
{
return Math.round(l + (Math.random() * (h - l)));
}
}
}
this function returns a random number between the two given values.
and in the AS3 .fla, i put this into the key frame:
import Math2;
trace(Math2.randRange(1, 10));
But i keep getting an error message that says:
“1195: Attempted access of inaccessible method randRange through a reference with static type Class.”
And i dont know why it doesnt work.
Many thanks in advanced