F-IN-BOX Delphi Edition Help >> How to

Loading a movie from a resource

Using the component you can load any flash movie from any stream object. Just use the LoadMovieFromStream and PutMovieFromStream methods. No temporary files! Load any flash movie on-the-fly from any supported source. For example, you can put one or more flash movies in the resource section of your application and then load it from the exe! That's the portability and power of TFlashPlayerControl!

Here's an example of how to load a flash movie from a resource:

[ Delphi ]
{$RESOURCE 'res\movie.res'}
...

type
  TMainForm = class(TForm)
    FlashPlayerControl1: TFlashPlayerControl;
...

  end;
...

procedure TMainForm.FormCreate(Sender: TObject);
var
  ResourceStream: TResourceStream;
begin
  ResourceStream := TResourceStream.Create(0, 'EmbeddedMovie', 'FLASH');
  FlashPlayerControl1.PutMovieFromStream(ResourceStream);
  ResourceStream.Free;
end;

[ Builder C++ ]
#pragma resource "res\\movie.res"
...

class TMainForm : public TForm
{
__published:
        void __fastcall FormCreate(TObject *Sender);
...

};
...

void __fastcall TMainForm::FormCreate(TObject *Sender)
{
  TResourceStream* ResourceStream = new TResourceStream(0, "EmbeddedMovie", "FLASH");
  FlashPlayerControl1->PutMovieFromStream(ResourceStream);
  delete ResourceStream;
}

More about TFlashPlayerControl
Copyright © Softanics. All rights reserved
F-IN-BOX is a registered trademark of Softanics|Delphi is a trademark of Borland Software Corporation|Macromedia and Shockwave Flash are trademarks of Adobe, Inc.