Main demo

Submitted by GROL on 24 October, 2010 - 00:00

The mega-demo for showing the main capabilities of the SDK. It covers almost all aspects of Flash usage:

  • Shapes - generating different shape types with various fills (including transparent fill) and Flash 8 effects (blending and filters).
  • Sound - embedding sound into flash clip and adjusting sound options.
  • Button - creating button and assigning URL to open on click.
  • Text - generating static, editable or HTML text within Flash clip.
  • Transformation - showing variants of object transformation (scale, move, skew, recolor).
  • Sprite - demonstrating ability to move and clone sprites.
  • Actions - displaying sample actions with object and testing different action sources.
  • Morphing - showing shape morphing with various morph fills.
  • Video - demonstrating possible actions with video clip (move, clone, rotate and more).
  • XML - generating flash clip from XML file.

Source archive: main.zip (1.6Mb)

 

Sample works

Some sample source: 
procedure TmDemo.bMakeClick(Sender: TObject);
var 
  Movie: TFlashMovie;
  I: Integer;
  il, il2: integer;
  Shapes: array [1..12] of TFlashShape;
  C: recRGBA;
  AP: array [0..6] of TPoint;
  AC: array [1..4] of recRGBA;
  Img: TFlashImage;
  But: TFlashButton;
  Txt: TFlashText;
  Sprite: TFlashSprite;
  Fnt: TFlashFont;
  FCh: TFlashChar;
  balpha: byte;
  TransX, TransY: integer;
  BDC, OFH: THandle;
  Morph: TFlashMorphShape;
  Video: TFlashVideo;
  PV, PV2: TFlashPlaceVideo;
  _label1: TSWFOffsetMarker;
  PStr: PChar;
begin
  Randomize;
 
  bPlay.Enabled := true;
  bPause.Enabled := true;
  bReweind.Enabled := true;
 
  GetEditValueState := 0;
  LGetText.Caption := '';
 
  Movie := TFlashMovie.Create(0, 0, 400 * twips, 400 * twips, 12);
  Movie.SystemCoord := scPix;
  Movie.Version := 7;
  Movie.Compressed := CBCompr.Checked;
  Movie.Protect := cbProtect.Checked;
  if cbProtect.Checked then
     Movie.Password := EPassw.Text;
 
  if CBPreloader.Checked then
    begin
      AC[1] := cswfGray70;
      AC[2] := cswfGray20;
      AC[3] := cswfGray60;
      AC[4] := cswfBlack;
      Movie.AddRectangle(0, 0, 200, 10).SetLinearGradient(AC, 270);
      Movie.AddFont(self.Font, true).Bold := true;
      with Movie.AddDynamicText('pr', '0%', cswfRed, Movie.Fonts[0], Rect(100, 100, 300, 120)) do
       begin
         AutoSize := false;
         NoSelect := true;
         Align := taCenter;
       end;
      Sprite := Movie.AddSprite;
      Sprite.PlaceObject(Movie.Shapes[0], 1);
 
      Sprite := Movie.AddSprite;
      with Sprite.PlaceObject(Movie.Shapes[0], 1) do
        begin
          ColorTransform.AddA := -180;
          SetTranslate(100, 115);
        end;
 
      Sprite.PlaceObject(Movie.Texts[0], 2).Name := 'prText';
 
      with Sprite.PlaceObject(Movie.Sprites[0], 10) do
       begin
        SetTranslate(100, 115);
        Name := 'pBar';
       end;
 
      Sprite.ShowFrame;
 
      with Movie.PlaceObject(Sprite, 1) do
      begin
       with OnEnterFrame do
        begin
{$IFDEF ASCompiler}
         Compile('loaded = int(100 * _root.getBytesLoaded() / _root.getBytesTotal());' +
                 'pBar._xscale = loaded;' +
                 'pr = loaded + "%";' +
                 'if (loaded == 100) { _root.gotoAndPlay(2); }');
{$ELSE}
          ConstantPool(['loaded', '_root', 'getBytesLoaded', 'getBytesTotal',
                        'pBar', '_xscale', 'pr', '%', 'gotoAndPlay']);
          Push([0, 100, 0, 1], [vtConstant8, vtInteger, vtInteger, vtConstant8]);
          GetVariable;
          PushConstant(2);
          CallMethod;
          Push([0, 1], [vtInteger, vtConstant8]);
          GetVariable;
          PushConstant(3);
          CallMethod;
          Divide;
          Multiply;
          ToInteger;
          SetVariable;
          PushConstant(4);
          GetVariable;
          PushConstant([5, 0]);
          GetVariable;
          SetMember;
          PushConstant([6, 0]);
          GetVariable;
          PushConstant(7);
          Add2;
          SetVariable;
          PushConstant(0);
          GetVariable;
          Push(100);
          Equals2;
          _Not;
          _label1 := _If.BranchOffsetMarker;
          Push([2, 1, 1], [vtInteger, vtInteger, vtConstant8]);
          GetVariable;
          PushConstant(8);
          CallMethod;
          Pop;
          SetMarker(_label1);
{$ENDIF}
        end;
      end;
 
      Movie.FrameActions.Stop;
      Movie.ShowFrame;
      Movie.RemoveObject(1);
    end;
 
  case Pages.ActivePageIndex of
   pShape:
       begin
         if CBBlend.ItemIndex > 1 then
           begin
             Movie.BackgroundMode := bmColor;
             Movie.BackgroundColor.RGB := SWFRGB(Random($FFFFFF));
             Shapes[1] := Movie.AddRectangle(0, 0, 600, 3);
             Shapes[1].SetLinearGradient(cswfBlue, cswfGreen);
             for il := 1 to 20 do
               Movie.PlaceObject(Shapes[1], il).SetTranslate(0, il*25);
           end;
 
         for il:=1 to 12 do
          begin
            Case rvShape.ItemIndex of
              0: Shapes[il] := Movie.AddRectangle(0, 0, Random(200),Random(200));
              1: Shapes[il] := Movie.AddStar(Random(100), Random(100), Random(150) - 50, Random(200), Random(100));
              2: Shapes[il] := Movie.AddEllipse(0, 0, Random(200),Random(200));
              3: Shapes[il] := Movie.AddCircle(Random(100), Random(100), Random(200));
              4: begin
                   AP[0] := Point(0, 0);
                   AP[6] := AP[0];
                   For il2:=1 to 5 do
                     AP[il2] := Point(Random(200), Random(200));
                   Shapes[il] := Movie.AddPolygon(AP);
                 end;
              5: Shapes[il] := Movie.AddRing(Random(100), Random(100), Random(100) + 20, Random(50)+20);
              6: Shapes[il] := Movie.AddPie(Random(100), Random(100), Random(100) + 20, Random(100) + 20, Random(360), Random(360));
              7: Shapes[il] := Movie.AddArc(Random(100), Random(100), Random(100) + 20, Random(100) + 20,
                                    Random(360), Random(360));
              8: Shapes[il] := Movie.AddDiamond(0, 0, Random(200),Random(200));
            end;
 
            C.R := Random(255);
            C.G := Random(255);
            C.B := Random(255);
            if UseA.Checked then C.A := Random(255) else C.A := $ff;
 
            Case FillShape.ItemIndex of
              0: Shapes[il].SetSolidColor(C);
              1: begin
                  case il of
                    1..3: Shapes[il].SetLinearGradient(C, cswfWhite, (il - 1) * 45);
                    4..5: begin
                         AC[1] := C;
                         AC[2] := cswfWhite;
                         AC[3] := C;
                         AC[4] := cswfBlack;
                         Shapes[il].SetLinearGradient(AC, 0);
                       end;
                    6..7: Shapes[il].SetRadialGradient(C, cswfWhite, 50, 50);
                    8: Shapes[il].SetRadialGradient(cswfWhite, C, 35, 35);
                    9..11: Shapes[il].SetRadialGradient(C, cswfWhite, (il - 9) * 30, (il - 9) * 20);
                    12: begin
                         AC[1] := C;
                         if UseA.Checked then AC[1].A := 0;
                         AC[2] := cswfWhite;
                         AC[3] := C;
                         AC[4] := cswfBlack;
                         Shapes[il].SetRadialGradient(AC, 50, 50);
                        end;
                  end;
                 end;
              2: begin
                  case il of
                   1:begin
                       Img := Movie.AddImage(ImgName.Text);
                       if UseA.Checked and img.AsJPEG then
                         begin
                          Img.MakeAlphaLayer;
                          Img.AlphaData.Position := 0;
                          for il2 := 0 to Img.AlphaData.Size - 1 do
                           begin
                            if (il2 mod Img.Width) = 0 then balpha := 255;
                            balpha := balpha - 1;
                            img.AlphaData.Write(balpha, 1);
                           end;
                         end;
                       Shapes[il].SetImageFill(Img, fmFit);
                     end;
                   2, 4, 8:
                     Shapes[il].SetImageFill(Img, fmClip);
                   3, 6, 7:
                      With Shapes[il].SetImageFill(Img, fmTile) do
                        Matrix.SetScale(2, 2);
                   else Shapes[il].SetImageFill(Img, fmFit);
                  end;
                 end;
            end;
 
            if cbLine.Checked then
              begin
                C.R := Random(255);
                C.G := Random(255);
                C.B := Random(255);
                Shapes[il].SetLineStyle(Random(10), C);
              end;
 
            with Movie.PlaceObject(Shapes[il], il + 100) do
              begin
                SetTranslate(Random(200), Random(200));
                if CBBlend.ItemIndex > 1 then BlendMode := CBBlend.ItemIndex;
                if CBFilter.ItemIndex > 0 then
                  Case CBFilter.ItemIndex - 1 of
                    fidDropShadow: Shadow;
                    fidBlur: Blur;
                    fidGlow: Glow;
                    fidBevel: Bevel;
                    fidGradientGlow: GradientGlow;
                    fidGradientBevel: GradientBevel;
                    fidColorMatrix:
                      ColorMatrix.AdjustColor(0, 0, -100, 0);
                  end;
              end;
            Movie.ShowFrame(2);
            if il > 6 then Movie.RemoveObject(il-6 + 100);
            Case il of
              4, 8, 12: Movie.ShowFrame(10);
            end;
 
          end;
       end;
 
   pSound: begin
             Movie.FPS := 12;
             Movie.BackgroundColor.RGB := SWFRGB(clSkyBlue);
             if fileExists(SndName.Text) then
               begin
                 Case sndVariant.ItemIndex of
                   1: begin // as event
                        With Movie.StartSound(Movie.AddSound(SndName.Text).CharacterID) do
                          begin
                            HasLoops := true;
                            try
                              LoopCount := StrToInt(sndLoop.Text);
                            except
                              LoopCount := 1;
                            end;
                            SyncNoMultiple := cbSyncNoMultiple.Checked;
                          end;
                        Movie.Sounds.Last.WaveCompressBits := WaveCompressBits.ItemIndex + 1;
                        Movie.ShowFrame;
                      end;
                   0: begin // as stream
                        Movie.BackgroundSound.LoadSound(SndName.Text);
                        Movie.BackgroundSound.WaveCompressBits := WaveCompressBits.ItemIndex + 1;
                        Movie.BackgroundSound.AutoLoop := cbAutoLoopStream.Checked;
                        if CBPreloader.Checked then
                          Movie.BackgroundSound.StartFrame := 1;
                        if not CBDuration.Checked then
                          try
                            MP3Duration := StrToFloat(SDuratiom.Text);
                          except
                            MP3Duration := Movie.BackgroundSound.Duration;
                          end;
                        Movie.ShowFrame(round(MP3Duration * Movie.FPS));
                      end;
                 end;
               end;
           end;
 
   pButton:begin
 
             Shapes[1] := Movie.AddCircle(0, 0, 40);
             Shapes[1].SetRadialGradient(cswfWhite, cswfBlue, 35, 35);
 
             Shapes[2] := Movie.AddCircle(0, 0, 40);
             Shapes[2].SetRadialGradient(cswfWhite, cswfNavy, 40, 40);
 
             But := Movie.AddButton;
 
             But.SndRollOver.SoundId := Movie.AddSound('event.wav').CharacterID;
             But.AddRecord(Shapes[1], [bsUp, bsHitTest]);
             with But.AddRecord(Shapes[1], [bsOver]) do
               Matrix.SetScale(1.1, 1.1);
 
             with But.AddRecord(Shapes[2], [bsDown]) do
               Matrix.SetScale(1.1, 1.1);
//             But.Actions.AddGetUrl(EOpenUtr.Text, '_blank');
             But.OnReleaseActions.GetUrl(EOpenUtr.Text, '_blank');
 
             Movie.PlaceObject(But, 1).SetTranslate(100, 100);
             Movie.ShowFrame;
           end;
   pText:begin
 
           if FntEmbed.Checked then
             begin
               Fnt := Movie.AddFont(BFont.Font, false);
               Fnt.Layout := true;
             end else
               Fnt := Movie.AddFont(BFont.Font);
 
           if RBText1.Checked then
             begin
               Shapes[1] := Movie.AddRectangle(50, 120, 200, 220);
               Shapes[1].SetLineStyle(1, cswfGray30);
 
               Movie.PlaceObject(Shapes[1], 1);
 
               Txt := Movie.AddText(StaticText.Text, cswfBlue, Fnt, Point(200, 120), taRight);
//               Txt.CharSpacing := 2; 
               Movie.PlaceObject(Txt, 2);
 
           //    Shapes[1] := Movie.AddRectangle(0, 0, 150, 50);
           //    Shapes[1].SetSolidColor(cswfYellow);
           //    Movie.PlaceObject(Shapes[1], 1);
             end;
 
           if RBText2.Checked then
             begin
               Fnt.AddChars(AllChars);
               Txt := Movie.AddDynamicText('EditText', EditText.Text, cswfBlue,
                                    Fnt, Rect(10, 100, 390, 150));
               Txt.Border := true;
              // Txt.Align := taCenter;
               Movie.PlaceObject(Txt, 2);
 
               Txt := Movie.AddDynamicText('EditText2', EditText.Text, cswfBlue,
                                    Fnt, Rect(10, 160, 390, 400));
               Txt.Border := true;
               Txt.WordWrap := true;
               Txt.Multiline := true;
               Txt.Align := taCenter;
               Movie.PlaceObject(Txt, 3);
 
               GetEditValueState := 1;
             end;
 
           if RBText3.Checked then
             begin
               Fnt.Bold := false;
               Fnt.Italic := false;
               Fnt.AddChars(AllEnglishChars);
 
               PStr := MemoHTML.Lines.GetText;
               Txt := Movie.AddDynamicText('', PStr, cswfGray50, Fnt, Rect(0, 0, 400, 400));
               StrDispose(PStr);
               TXT.HTML := true;
               Txt.ReadOnly := true;
               Txt.Multiline := true;
               Movie.PlaceObject(Txt, 3);
               if FntEmbed.Checked then
                 begin
                   Fnt := Movie.AddFont(BFont.Font, false);
                   Fnt.Bold := true;
                   Fnt.Italic := false;
                   Fnt.FontUsing := [fuDynamicText];
                   Fnt.AddChars('bold');
                   Fnt.Layout := true;
 
                   Fnt := Movie.AddFont(BFont.Font, false);
                   Fnt.Bold := false;
                   Fnt.Italic := true;
                   Fnt.FontUsing := [fuDynamicText];
                   Fnt.AddChars('italc'); // two "i"
                   Fnt.Layout := true;
                 end;
             end;
           Movie.ShowFrame;
         end;
   pTransform:
     begin
       Shapes[1] := Movie.AddCircle(0, 0, 50);
       Shapes[1].SetRadialGradient(cswfWhite, SWFRGBA(clNavy), 35, 35);
 
       if not (Trans1.Checked or Trans2.Checked or Trans3.Checked or Trans4.Checked) then Trans1.Checked := true;
 
       For il := 0 to 40 do
        begin
         With Movie.PlaceObject(Shapes[1], 1) do
           begin
             if Trans1.Checked then
               SetScale(1+il / 10, 1+il / 20);
             TransX := 200;
             TransY := 200;
             if Trans2.Checked then
               begin
                 TransX := TransX + il*2;
                 TransY := TransY - il*2;
               end;
             SetTranslate(TransX, TransY);
 
             if Trans3.Checked then
               SetSkew(il /10, 0);
 
             if Trans4.Checked then
               InitColorTransform(true, Round(il / 40 * 255), 0, -Round(il / 40 * 255), 0,
                                  false, 0, 0, 0, 0,
                                  true);
 
             if il>0 then RemoveDepth := true
               else Movie.ShowFrame(5);
           end;
 
           Movie.ShowFrame;
        end;
 
     end;
   pSprite:
     begin
       Shapes[1] := Movie.AddRectangle(0, -45, 100, 45);
       C.R := Random(255);
       C.G := Random(255);
       C.B := Random(255);
       C.A := 200;
       AC[1] := C;
       AC[2] := cswfWhite;
       AC[3] := C;
       AC[4] := cswfBlack;
       Shapes[1].SetLinearGradient(AC, 0);
 
       Sprite := Movie.AddSprite;
       Sprite.PlaceObject(Shapes[1], 1);
       Sprite.ShowFrame;
       For il := 1 to 10 do
        begin
         With Sprite.PlaceObject(Shapes[1], 1) do
          begin
            if il > 5 then  SetScale(1, 1 + (10 - il)/ 10)
              else SetScale(1, 1 + il/ 10);
            RemoveDepth := true
          end;
         Sprite.ShowFrame;
        end;
 
       if Sprite2.Checked then
         Movie.PlaceObject(Sprite, 2).SetTranslate(150, 200);
 
       if not Sprite1.Checked then
         begin
          Movie.PlaceObject(Sprite, 1).SetTranslate(150, 100);
          Movie.ShowFrame;
         end else
        For il := 1 to 30 do
         with Movie.PlaceObject(Sprite, 1) do
         begin
           SetRotate(360 * il / 30);
           SetTranslate(50 + il*6, 100);
           if il > 1 then RemoveDepth := true;
           Movie.ShowFrame;
         end;
 
     end;
   PScript:
     begin
       Txt := Movie.AddDynamicText('EditText', '0', cswfRed,
                            Movie.AddFont(BFont.Font), Rect(30, 10, 100, 50));
       Txt.ReadOnly := true;
       Txt.NoSelect := true;
       Movie.PlaceObject(Txt, 1);
 
       Shapes[1] := Movie.AddCircle(0, 0, 20);
       Shapes[1].SetRadialGradient(cswfWhite, cswfGray60, 35, 35);
 
       But := Movie.AddButton;
       But.AddRecord(Shapes[1], [bsUp, bsOver, bsHitTest]);
       With But.AddRecord(Shapes[1], [bsDown]).ColorTransform do
         begin
           addR := 200;
           addG := 10;
           addB := 10;
         end;
 
       if ASSource.ItemIndex = 0 then
         With But.OnReleaseActions do
           begin
            Push('EditText');
            GetVariable('EditText');
            ToInteger;
            Push(1);
            Operation('+');
            SetVariable;
           end
          else
{$IFDEF ASCompiler}
         But.CompileEvent('on(release){EditText = int(EditText) + 1;}')
{$ENDIF};
 
 
       with Movie.PlaceObject(But, 2) do
         begin
          SetTranslate(200, 200);
          Name := 'but';
         end;
 
       Movie.ShowFrame;
 
       With Movie.FrameActions do
        if ASSource.ItemIndex = 0 then
         begin
 
          Push([1,'but', fpPosX, 'but', fpPosX]);
          GetProperty;
          Random(7, 15);
          Operation('+');
          SetProperty;
 
          Push(['but', fpPosY, 'but', fpPosY]);
          GetProperty;
          Random(7, 15);
          Operation('+');
          SetProperty;
 
          GotoFrame2(true);
         end else
{$IFDEF ASCompiler}
          Compile('but._x += (random(15) - 7);' +
                  'but._y += (random(15) - 7);' +
                  'gotoAndPlay(1);');
{$ELSE}
         ShowMessage('Your license not support ActionScript Compiler features!');
{$ENDIF}
       Movie.ShowFrame;
     end;
   pMorph:
     begin
       Morph := Movie.AddMorphShape;   // 1
       Morph.SetStartBound(0, 0, 50, 50);
       Morph.SetEndBound(-70, -70, 70, 70);
       if CBLineM.Checked then
         Morph.SetLineStyle(1, 12, cswfBlue, cswfYellow);
       case RBMorphFill.ItemIndex of
         1: Morph.SetSolidColor(cswfGray10, cswfRed);
         2: Morph.SetLinearGradient(cswfRed, cswfWhite, cswfRed, cswfBlack, 0, 90);
         3: Morph.SetRadialGradient(cswfRed, cswfWhite, cswfRed, cswfBlack, 50, 50, 35, 35);
       end;
 
       With Morph.StartEdges do
         begin
          MoveDelta(-50, 0);
          MakeEllipse(50, 50);
          MakeMirror(true, false);
         end;
 
       With Morph.EndEdges do
         begin
           MakeStar(0, 0, 60, 30, 8, true);
           MakeMirror(true, false);
         end;
 
       for il := 0 to 20 do
         begin
           With Movie.PlaceObject(Morph, 1) do
            begin
              Ratio := Round(il / 20 * $FFFF);
              if il > 0 then RemoveDepth := true
                else SetTranslate(100, 100);
            end;
           Movie.ShowFrame;
         end;
       Movie.ShowFrame(2);
       Movie.RemoveObject(1);
 
       Morph := Movie.AddMorphShape;   // 2
       Morph.SetStartBound(-70, -70, 70, 70);
       Morph.SetEndBound(-3, -3, 103, 63);
 
       if CBLineM.Checked then
         Morph.SetLineStyle(12, 6, cswfYellow, cswfBlack);
       case RBMorphFill.ItemIndex of
         1: Morph.SetSolidColor(cswfRed, cswfGreen);
         2: Morph.SetLinearGradient(cswfRed, cswfBlack, cswfBlue, cswfBlack, 90, 180);
         3: Morph.SetRadialGradient(cswfRed, cswfBlack, cswfBlack, cswfBlue, 35, 35, 50, 70);
       end;
 
       With Morph.StartEdges do
         begin
           MakeStar(0, 0, 60, 30, 8, true);
           MakeMirror(true, false);
         end;
       With Morph.EndEdges do
         begin
           MoveDelta(-100, 0);
           LineDelta(20, 0);
           LineDelta(0, 30);
           LineDelta(50, 0);
           LineDelta(0, -30);
           LineDelta(30, 0);
           LineDelta(0, 60);
           LineDelta(-100, 0);
           LineDelta(0, -60);
           MakeMirror(true, false);
         end;
 
       for il := 0 to 20 do
         begin
           With Movie.PlaceObject(Morph, 1) do
            begin
              Ratio := Round(il / 20 * $FFFF);
              if il > 0 then RemoveDepth := true
                else SetTranslate(100, 100);
            end;
           Movie.ShowFrame;
         end;
      Movie.ShowFrame(2);
      Movie.RemoveObject(1);
 
      Morph := Movie.AddMorphShape;   // 3
      Morph.SetStartBound(-3, -3, 103, 63);
      Morph.SetEndBound(0, 0, 50, 50);
 
      if CBLineM.Checked then
         Morph.SetLineStyle(6, 1, cswfBlack, cswfBlue);
      case RBMorphFill.ItemIndex of
         1: Morph.SetSolidColor(cswfGreen, cswfGray10);
         2: Morph.SetLinearGradient(cswfBlue, cswfBlack, cswfRed, cswfWhite, 180, 0);
         3: Morph.SetRadialGradient(cswfBlack, cswfBlue, cswfRed, cswfWhite, 50, 70, 50, 50);
      end;
 
      With Morph.StartEdges do
        begin
           MoveDelta(-100, 0);
           LineDelta(20, 0);
           LineDelta(0, 30);
           LineDelta(50, 0);
           LineDelta(0, -30);
           LineDelta(30, 0);
           LineDelta(0, 60);
           LineDelta(-100, 0);
           LineDelta(0, -60);
           MakeMirror(true, false);
        end;
 
       With Morph.EndEdges do
         begin
          MoveDelta(-50, 0);
          MakeEllipse(50, 50);
          MakeMirror(true, false);
         end;
 
      for il := 0 to 20 do
       begin
         With Movie.PlaceObject(Morph, 1) do
          begin
            Ratio := Round(il / 20 * $FFFF);
            if il > 0 then RemoveDepth := true
              else SetTranslate(100, 100);
          end;
         Movie.ShowFrame;
       end;
     Movie.ShowFrame(2);
 
    end;
  pVideo:
        begin
          Movie.BackgroundColor.RGB := SWFRGB(clBlack);
          if fileExists(VFIleEdit.Text) then
          begin
            Video := Movie.AddVideo(VFIleEdit.Text);
            FLV := Video.FLV;
            Movie.FPS:=WordToSingle(FLV.FPS);
            PV := Movie.PlaceVideo(Video, 2);
            PV.EnableSound:=VSoundEnableChecker.Checked;
            PV.StartFrame := StrToInt(VEStartFrame.Text);
            if (PV.StartFrame = 0) and CBPreloader.Checked then PV.StartFrame := 1;
            PV.AutoReplay := false;
            try
              AP[0].X := StrToInt(VEX.Text);
            except
              AP[0].X := 0;
            end;
            try
              AP[0].Y := StrToInt(VEY.Text);
            except
              AP[0].Y := 0;
            end;
            PV.SetTranslate(AP[0].X, AP[0].Y);
            if VCBoxPlace.Checked then
            begin
               PV2 := Movie.PlaceVideo(Video, 1);
               PV2.SetTranslate(AP[0].X, AP[0].Y);
               PV2.onPlaceFrame := CustomPlace;
            end;
            if VCBoxWriteFrame.Checked then
            begin
               PV2:=Movie.PlaceVideo(Video, 3);
               PV2.onWriteFrame := CustomWrite;
            end;
          end;
          Movie.ShowFrame(FLV.FrameCount + 10);
          //ShowMessage(IntToStr(FLV.FrameCount));
         end;
   pXML: begin
{$IFDEF XMLSupport}
           PStr := EXML.Lines.GetText;
           Movie.LoadFromXMLString(PStr, true);
           StrDispose(PStr);
{$ELSE}
           Txt := Movie.AddDynamicText('', 'Your license not support XML features!', cswfRed,
                                Movie.AddFont(BFont.Font), Rect(30, 10, 300, 50));
           Txt.ReadOnly := true;
           Txt.NoSelect := true;
           Txt.WordWrap := true;
           Txt.AutoSize := true;
           Movie.PlaceObject(Txt, 1);
{$ENDIF}
         end;
  end;
 
  Movie.MakeStream;
  Movie.SaveToFile(eName.Text);
  Movie.Free;
 
  FlashPlayer.Movie := TmpName; // for empty last movie
  FlashPlayer.Movie := eName.Text;
 
  TrackBar.Max := FlashPlayer.TotalFrames - 1;
  lFrames.AutoSize := true;
  lFrames.Caption := IntToStr(FlashPlayer.TotalFrames)+'/'+IntToStr(FlashPlayer.TotalFrames) + ' frm';
  lFrames.AutoSize := false;
  FlashPlayer.Play;
  P4Resize(nil);
  TimerSWF.Enabled := true;
  if GetEditValueState = 1 then GetEditValueState := 2;
 
end;