Question

I'm following the book "Flash Game Development By Example", and I'm currently on the Chapter Two, on the Minesweeper game. The problem I'm having is after I start inputting the code to make the tile displaying and I got the following errors: 1046: Type was not found or was not a compile-time constant: tile_movieclip. and 1180: Call to a possibly undefined method tile_movieclip.. The lines where they've appeared are, respectively:

private var tile:tile_movieclip;

and

tile = new tile_movieclip();

I have no clue about why it isn't working. The book doesn't mentions anything about the error, and I've already tried copy/pasting the code from the book, but it haven't worked either. I'm currently using Adobe Flash CS4.

The current source code is here: http://pastebin.com/spUzPGBx. It might have other errors, since I was still debugging it when I found this error.

Was it helpful?

Solution

In order for that code to work, you need 1 of 2 possible things :

1 - A class named tile_movieclip

2 - A library symbol that is named tile_movieclip and has linkage set on it's properties panel, which will automatically create a class named tile_movieclip when compiled.

I am going to guess that the book you are using has a .fla file that goes along with that example.

UPDATE - I just downloaded the .pdf of that book and on page 22 it describes creating this symbol in your library and setting linkage.

So.... I think we can consider this mystery solved.

OTHER TIPS

That means the flash thinks the class tile_movieclip does not exist. If it does indeed exist then it means flash doesn't know how to access it.

There are many possible reasons why this happens depending on how your project is structured. If you are trying to access an external library, a library item, some class in your project, etc.

Please specify in your question where you think the class tile_movieclip is located and I'll be able to provide a more specific answer.

As a side note, in AS3 (and probably all programming languages) it is a standard to name classes with an upper case letter, so it's easier to distinguish between vars and classes. In AS3 in particular sprite is a var, and Sprite is a class. AS3 is a case sensitive language.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top