How to open SWF from the memory?

Unfortunately, the "standard" TShockwaveFlash does not contain any methods to play SWF from stream. Besides, a player does not load SWF if its name is the same as a previous opened SWF. So, quite often we have to use the following code:

var
  blankSWF, realSWF: string;
...
// create a blank temp file
  blankSWF := tempDir + '\' + {randomize name};
 
// create a real movie
  realSWF := tempDir + '\' + {randomize name};
 
  Player.Movie := blankSWF;
  Player.Movie := realSWF;

How to avoid that and open SWF from memory?
The property TShockwaveFlash.EmbedMovie was an incitement to me. If it is set to true then the file TShockwaveFlash.Movie is included to DFM as resource. DFM analyzing shows that SWF is stored in the ControlData "section" together with other properties: Movie, ScaleMode, Quality, etc.

The first try was using TStream.WriteComponent and TStream.ReadComponent. After WriteComponent calling the saved data was analyzed and the SWF was wrote to a required place. Unfortunately, ReadComponent calling did not give an expect result and the data relevant to ControlData was not updated. For example:

player: TShockwaveFlash;
 
  mem: TMemoryStream;
...
  player.ScaleMode := 2; // exact fit
  mem.WriteComponent(Player); 
 
  player.ScaleMode := 0; // show all
  mem.Position := 0;
  mem.ReadComponent(player);
  mem.Free;
 
  ShowMessage('Scale mode is ' + IntToStr(player.ScaleMode));  // show 0,  not 2 !!!

Partly, it was fixed with the player control removing but it was not the best solution, because at least there was flickering.

player: TShockwaveFlash;
 
  mem: TMemoryStream;
  OldParent: TWinControl;
...
  player.ScaleMode := 2; // exact fit
  mem.WriteComponent(Player); 
  OldParent := Player.Parent;
  Player.Free;
 
  mem.Position := 0;
  RegisterClass (TShockwaveFlash);
  Player := TShockwaveFlash (mem.ReadComponent(nil));
  Player.Parent := OldParent;
  Mem.Free;
  UnRegisterClass (TShockwaveFlash);
 
  ShowMessage('Scale mode is ' + IntToStr(player.ScaleMode));  // show 2, ok!

Analyzing the source TOleControl I came to a conclusion that after a control is created the ControlData is read but the value is not applied. To fix that the access to the field FObjectData is required but it is impossible because it is a private member. To avoid all these troubles I had to realize own method LoadMovieFromStream for an alternate way of data uploading.