Ever consider making flash player controls interfaces?
Posted: Wed Nov 12, 2008 4:26 pm
I've been dealing a little bit with TFlashPlayerControl and TTransparentFlashPlayerControl. Each is it's own separate class. You've stated before that TFlashPlayerControl is more efficient so you should use it when you don't need transparency.
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:
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.
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.