Flash compiler error 1061: Call to a possibly undefined method run... but run exists!
Posted
by
Zane Geiger
on Stack Overflow
See other posts from Stack Overflow
or by Zane Geiger
Published on 2011-03-01T22:57:05Z
Indexed on
2011/03/01
23:25 UTC
Read the original article
Hit count: 224
So I've been working on making a game in Processing but I think Flash would be a better way to get more people playing it, so I've decided to learn Flash. The problem is that I keep getting really stupid errors on incredibly simple things. For instance, I want to make a 'Block' object to use in a platform game. So I make a new .as file, name it Block.as, and define the Block class within it like so:
package {
public class Block {
public function Block() {
// constructor code
}
public function run()
{
}
}
}
I don't want to add the code yet, I just want to ensure that this works. So in my main timeline code, I try to create an instance of the Block object and execute its run method:
var block1:Block = new Block();
block1.run();
Every time it gives me this inane error:
Scene 1, Layer 'Layer 1', Frame 1, Line 2 1061: Call to a possibly undefined method run through a reference with static type Block.
What undefined method!? It's defined RIGHT THERE in Block.as. The class file is even in the same folder and everything. I'm getting REALLY annoyed at how poorly Flash handles such a ridiculously simple project. Does anyone know why Flash hates me?
© Stack Overflow or respective owner