Slider

Submitted by GROL on 9 July, 2010 - 22:00
Flash Slideshow SWF

Simple slide show demonstration with using 3 images and different effects.

Source archive: slider.zip (268 KB)

 

Sample works

Some sample source: 
var 
  Movie: TFlashMovie;
  il: integer;
  s: single;
 
const
  SWFFPS = 20;
 
 function myDelay(sec: single): integer;
 begin
   Result := Round(sec * SWFFPS);
   if Result = 0 then Result := 1; 
 end;
 
begin
  Movie := TFlashMovie.Create(0, 0, 320 * twips, 240 * twips, SWFFPS);
  Movie.Version := 6;
  Movie.SystemCoord := scPix;
 
  for il := 1 to 3 do
    Movie.AddShapeImage(IntToStr(il)+'.jpg');
 
// plane change slide
  for il := 0 to 2 do
   begin
    with Movie.PlaceObject(Movie.Shapes[il], 1) do
     if il > 0 then RemoveDepth := true;
      Movie.ShowFrame(myDelay(1));
   end;
  Movie.ShowFrame(myDelay(1));
 
// fade in
  For il := myDelay(1) downto 0 do
   with Movie.PlaceObject(Movie.Shapes[1], 2) do
    begin
     ColorTransform.AddA := - Round(il / myDelay(1) * $FF);
     if il < myDelay(1) then RemoveDepth := true;
     Movie.ShowFrame;
    end;
  Movie.ShowFrame(myDelay(1));
 
// move
  For il := myDelay(1) downto 0 do
   with Movie.PlaceObject(Movie.Shapes[0], 3) do
    begin
     TranslateX := Round(il / myDelay(1) * 320);
     if il < myDelay(1) then RemoveDepth := true;
     Movie.ShowFrame;
    end;
  Movie.ShowFrame(myDelay(1));
 
// scale + move + fade out
  For il := 0 to myDelay(1) do
   begin
     with Movie.PlaceObject(Movie.Shapes[1], 2) do
      begin
       TranslateX := Round(il / myDelay(1) * 320);
       TranslateY := Round(il / myDelay(1) * 240);
       SetScale((myDelay(1) - il) / myDelay(1), (myDelay(1) - il) / myDelay(1));
       ColorTransform.AddA := - Round(il / myDelay(1) * $80);
       RemoveDepth := true;
      end;
 
     with Movie.PlaceObject(Movie.Shapes[0], 3) do
      begin
       TranslateY := Round(il / myDelay(1) * 240);
       SetScale((myDelay(1) - il) / myDelay(1), (myDelay(1) - il) / myDelay(1));
       RemoveDepth := true;
       ColorTransform.AddA := - Round(il / myDelay(1) * $80);
      end;
      Movie.ShowFrame;
   end;
  Movie.ShowFrame(myDelay(1));
 
// rotate + scale
  For il := 0 to myDelay(1) do
   begin
     with Movie.PlaceObject(Movie.Shapes[2], 1) do
      begin
       TranslateX := Round(il / myDelay(1) * 320 * 2 / 3);
       TranslateY := Round(il / myDelay(1) * 240 * 2 / 3);
       SetScale((myDelay(1) - il) / myDelay(1), (myDelay(1) - il) / myDelay(1));
       SetRotate(360*il/myDelay(1));
       RemoveDepth := true;
      end;
 
      Movie.ShowFrame;
   end;
  Movie.ShowFrame(myDelay(1));
 
  Movie.ShowFrame;
  Movie.MakeStream;
  Movie.SaveToFile('demo.swf');
  Movie.Free;
 
  ShellExecute(0, 'open', 'demo.swf', nil, nil, SW_Normal);
end.