F-IN-BOX Delphi Edition Help >> TFlashPlayerControl / TTransparentFlashPlayerControl >> Events >> Extensions

OnLoadExternalResource

Syntax

[ Delphi ]
type TFlashPlayerControlOnLoadExternalResource = procedure(ASender: TObject; const URL: WideString; Stream: TStream) of object; 
property OnLoadExternalResource: TFlashPlayerControlOnLoadExternalResource;

[ Builder C++ ]
typedef void __fastcall (__closure *TFlashPlayerControlOnLoadExternalResource)
   (System::TObject* ASender, const System::WideString URL, Classes::TStream* Stream);

Remark

From version 3.1 the argument URL has been changed to WideString (in previous versions the type was AnsiString / string).

Description

The event is called only for movies loaded from a TStream. For other cases, please use: SetGlobalOnLoadExternalResourceHandler The event OnLoadExternalResource is called when a movie tries to load an external resource (xml, jpeg, etc.) using a relative path. The event is called only if the movie is loaded from a stream.

For instance, a movie loads an image using the following code:

[ ActionScript ]
loadMovie("images/external_image.jpg", "square");

You can provide the content of this image by handling the event OnLoadExternalResource:

[ Delphi ]
procedure TForm1.FlashPlayerControl1LoadExternalResource(ASender: TObject; const URL: WideString; Stream: TStream);
var
  ResourceStream: TResourceStream;
begin
  if URL = 'images/external_image.jpg' then
  begin
    ResourceStream := TResourceStream.Create(0, 'some_image', 'IMAGE');
    ResourceStream.SaveToStream(Stream);
    ResourceStream.Free;
  end;
end;

[ Builder C++ ]
void __fastcall TMainForm::FlashPlayerControl1LoadExternalResource(
      TObject *ASender, const WideString URL, TStream *Stream)
{
  if (URL == WideString("images/external_image.jpg"))
  {
    TResourceStream* ResourceStream = new TResourceStream(0, "image1", "IMAGE");
    ResourceStream->SaveToStream(Stream);
    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.