But it makes the code a little gross if you want to have your program able to switch between the two. I have to do things like:
Code: Select all
if FlashPlayer is TFlashPlayerControl then
Result := TFlashPlayerControl(FlashPlayer).CallFunction(request)
else if FlashPlayer is TTransparentFlashPlayerControl then
Result := TTransparentFlashPlayerControl(FlashPlayer).CallFunction(request);
This made me wonder why you don't just make an IFlashPlayerControl interface. It would have all the functions and properties that are common to both classes (the majority of stuff after "// Loading movie from stream").
Then you could get the benefits of both FlashPlayer components inheriting from a common source with only a slight hassle of having to use IFlashPlayerControl.