Originally Posted by airwin
i have the same error message for my code but i don't understand what "You have to instantiate object from class to access its methods or create static class" means.
public class BoardView extends MovieClip
private var stoneArray:Array = new Array();
public function BoardView():void
public function setStone():void
for(var i = 0; i < 19; i++)
for(var a = 0; a < 19; a++)
var oneStone:StoneView = new StoneView();
oneStone.x = 32 + (15*i);
oneStone.y = 20 + (15*a);
private function stoneClicked(e:MouseEvent):void
var pickedStone:StoneView = StoneView(e.target);
What Hardyvoje was saying is that the original poster appeared to be confused about how to use a class (I would also say that the defined class is not Object Oriented either).
It is unfortunate that ActionScript decided to use "CLASS(variable)" as the syntax for coercion (or casting as other languages call it) instead of "(CLASS)variable" which I believe would have been less confusing.
So when eliddell did this:
var slides:Array = new Array(["mov","1"],
Eliddell clearly thought he was calling the constructor for the class printMovie, but how ActionScript saw it was that he was trying to change the type of "slides" to the type "printMovie". Clearly this is not a reasonable translation.
Now, from your code above, you have a similar line of code, but in your case you really are casting the event object into an object of the type StoneView, which as I see it shouldn't be a problem. So, first I would say that we need to see your actual error message and maybe if you included StoneView I might be able to see the problem, or maybe after this description you will be able to see it yourself.