How to tie a control-class to an embeded .swf?

For your information, I’m using the flex 2 compiler.

I have a class called “Tile”, which extends MovieClip. It has basic functions for manipulating a tile. In my main file, I embed an .swf which contains an animated tile.


(BTW, thanks a bunch for letting “Embed” be case-sensitive and just failing silently if you happen to use a lowercase “e”)

Now, I want to tie the tile.swf to my “Tile” control class. This is where I fail miserably.

I cannot use

private var TileClass:Tile;

since embeded resources needs to be either Class or String.

So I try to

private var TileClass:Class;
var t:Tile = new TileClass();

since Tile extends MovieClip and the .swf most definitely is a MovieClip, but that fails with a coercion error (Casting does not help).

According to the documentation I have, you can only [embed] an .swf at the variable level, so I cant do

Public class TileClass extends Tile;

In the Flash Authoring Tool™ I simply did some settings in the library and said that the .swf was a subclass of Tile. Now, there has to be some way to do this in code as well?

I don’t want to make my Tile class the class of the .swf itself, since that would tie the graphics and the code together. I need a system where I can simply alter the .swf with the animation I want and load that in place of what I am currently using, without changing anything other than the [Embed] line.

Any and all ideas are welcome.