Hello,
i am not sure that my problem is for here but as they say you'll never know inless you ask so here i go:

i am creating a game turn based strategy to be exact and i am almost done the one last thing that i need to do is create some different map than a random generated squares so i started creating a map editor.
In the map editor i have a

[pascal]
TTile = class(TImageSprite)
private
public
TileSize: integer;
TilePicture: TBitmap;
TileType:integer;
TilePos : record
X : integer;
Y : integer;
end;
TileExist:Boolean;[/pascal]
type and a


[pascal] Tile: array [1..5000] of TTile;[/pascal]

var so i create the map and then save it using the procedure

[pascal]procedure SaveTheTiles;
var f:file of TTile;i:integer;
begin
assignfile(f,'tmp.map');
rewrite(f);

for i:=1 to 5000 do
if (Tile[i] <> Nil) then
write(f,Tile[i]);

CloseFile(f);

end;[/pascal]

i know its not the best way to do it but lets leave that behind for now.
So anyway i save the map and then try to load it in the game

[pascal]procedure TMap.Load;
var f:file of TTile;
begin
assignfile(f,'tmp.map');
reset(f);

while not eof(f) do begin
numberunits.tiles :=numberunits.tiles+1; // this is defined as global var and also the starting value is 0
Tile[numberunits.tiles]:=TTile.Create(form1.dxspriteengine1.Engine);
read(f,Tile[numberunits.tiles]);
end;
closefile(f);
end;[/pascal]

so far so good but when i try to access some value in the array of Tiles
example:
showmessage(inttostr(tile[1].tilesize));
i get an error :

project1.exe raised an exception class bla bla access violation at address 004667A0 bla bla and so on....

i dont get it why do i get an error ??!?!?!?!?!?!!??
if someone can help PLEASEEEEEEEE help me
thanks[/pascal]