how to work around an "illegal castmember" error
error illegal_castmember workaround

  Illegal Castmember error
Luke Wigley <>
wrote on the subject of 

Illegal Castmember error

I've experienced a similar problem. I my case, it was 2 bitmaps that were
corrupted. The trick was getting access to the cast to delete them without
having Director try and load them first.

If I remember correctly, the way of fixing it was to do this

1. create a director movie with an external cast
2. make sure the property of the external cast is set to 'load when needed'
3. make sure that the external cast is not referenced anywhere in the main
movie (eg an empty cast)
4. use a handler like this to switch the filePath of the external cast to
the corrupt one and delete the offending castmember

on fix
  oldPath = castlib(2).filePath
  castlib(2).filePath = the moviePath & "corrupted cast"
  erase member (1,2) -- erase member 1 of castlib 2
  castlib(2).filePath  = oldPath

5. Make sure that the castlib window is closed before running this handler
(if the window is open, then Director will try and draw the preview of all
the castmembers, which will cause an error when it tries to address the
corrupted member).

Before you do this, though - try changing the external Quicktime file that
is being referenced by the suspect cast member (ie replace the quicktime
file, which must be external, with another quicktime file that you know

Another trick is to try an open the file up on a PC (though my experience is
that PCs usually seem more delicate at dealing with corrupted casts than

Hope this helps (corrupted castmembers are a real pain, and they seem to
happen too frequently to me). Even if this does work, I'd recommend
rebuilding the cast from scratch using as much source media as you can
rather than copying and pasting whatever castmembers you can recover from
the problem cast)

Home shock + cgi Bits 'n pieces Director Lingo ShockLets Contact