Search code examples
actionscript-3flashmovieclipflash-cs4

1046: Type was not found or was not a compile-time constant: tile_movieclip


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.


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.