Storage

Submitted by eLenka on 11 October, 2010 - 16:27

Storage control helps to store data needed for playing flash movies. Source archive includes 4 samples:

  • Adobe Clock sample
  • Video sample
  • Slideshow sample
  • XML-driven flash chart sample

Note. Flash Viewer Engine is needed.

Source archive: storage.zip (2.21Mb)
 

 
Some sample source: 
procedure TForm1.ComboBox1Select(Sender: TObject);
begin
  case ComboBox1.ItemIndex of
    0: Player.Movie := 'adobe_clock.swf';
    1: Player.Movie := 'matrix.flv';
    2: Player.Movie := 'imageloading.swf';
    3: Player.Movie := 'live_chart.swf';
  end;
end;
 
procedure TForm1.FlashStorageCheckURL(sender: TfeFlashList; URL: string; var Accept: Boolean);
begin
  if (Pos('crossdomain.xml', URL) > 0) or (Pos('data.php', URL) > 0) then
    Accept := true;
end;
 
procedure TForm1.FlashStorageGetUrl(sender: TfeFlashList; URL: string; var Data: TStream);
var
  S: string;
  count, i: integer;
  smin: double;
begin
  if Pos('crossdomain.xml', URL) > 0 then
  begin
    if CrossDomain = nil then
      CrossDomain := TStringStream.Create('<?xml version="1.0"?><cross-domain-policy><allow-access-from domain="*" /></cross-domain-policy>');
    Data := CrossDomain;
  end else
  if Pos('data.php', URL) > 0 then
  begin
    if DataXML <> nil then DataXML.Free;
    count := 10;
    smin := SecondOf(Time) / 60;
    S := '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>' +
    '<Project><Data>' +
    '<ColCount>3</ColCount><RowCount>' + IntToStr(count + 1) + '</RowCount><Item0>';
    for i := 1 to count do
      S := S + '|min' + IntToStr(i);
    S := S + '</Item0><Item1>1';
    for i := 1 to count do
      S := S + '|' + FloatToStr(sin(2 * Pi * (smin + i / 10))* 10) ;
    S := S+ '</Item1><Item2>1';
    for i := 1 to count do
      S := S + '|' + FloatToStr(cos( 2 * Pi * (smin + i / 10))* 10);
    S := S+ '</Item2></Data></Project>';
    DataXML := TStringStream.Create(S);
    Data := DataXML;
  end;
end;