明輝手游網(wǎng)中心:是一個(gè)免費(fèi)提供流行視頻軟件教程、在線學(xué)習(xí)分享的學(xué)習(xí)平臺(tái)!

用delphi做flash播放器

[摘要]在窗體上添加opendialog1控件,一個(gè)timer控件,一個(gè)mianmenu控件, 一個(gè)trackbar1控件。 歡迎各位提出意見(jiàn)!! 以下是代碼 unit flash; interface uses Windows, Messages, SysUtils, Classes, Graphi...
在窗體上添加opendialog1控件,一個(gè)timer控件,一個(gè)mianmenu控件,
一個(gè)trackbar1控件。

歡迎各位提出意見(jiàn)!

以下是代碼
unit flash;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Menus, OleCtrls, ShockwaveFlashObjects_TLB, ComCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    ShockwaveFlash1: TShockwaveFlash;
    OpenDialog1: TOpenDialog;
    MainMenu1: TMainMenu;
    N1: TMenuItem;
    TrackBar1: TTrackBar;
    Timer1: TTimer;
    N2: TMenuItem;
    N3: TMenuItem;
    N4: TMenuItem;
    N5: TMenuItem;
    N6: TMenuItem;
    N7: TMenuItem;
    N8: TMenuItem;
    N9: TMenuItem;
    procedure N1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    procedure TrackBar1Change(Sender: TObject);
    procedure N3Click(Sender: TObject);
    procedure N4Click(Sender: TObject);
    procedure N6Click(Sender: TObject);
    procedure N7Click(Sender: TObject);
    procedure N9Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.N1Click(Sender: TObject);
begin  //菜單打開(kāi)的事件
if opendialog1.execute
then
if opendialog1.filename<>''
then
begin
shockwaveflash1.movie:=opendialog1.filename;
timer1.enabled:=true;
trackbar1.max:=shockwaveflash1.TotalFrames;
shockwaveflash1.Play;
end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
timer1.enabled:=false;//初始化代碼
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
trackbar1.position:=trackbar1.position+1;//時(shí)間響應(yīng)
end;

procedure TForm1.TrackBar1Change(Sender: TObject);
begin
trackbar1.position:=shockwaveflash1.FrameNum;//trackbar1的響應(yīng)
end;

procedure TForm1.N3Click(Sender: TObject);
begin
shockwaveflash1.Forward;//向前一幀
shockwaveflash1.play;
end;

procedure TForm1.N4Click(Sender: TObject);
begin
shockwaveflash1.back;//向后一幀
shockwaveflash1.play;
end;

procedure TForm1.N6Click(Sender: TObject);
begin
if opendialog1.filename<>''
then
begin
shockwaveflash1.Stop;//暫停命令
n6.checked:=true;
end;
end;

procedure TForm1.N7Click(Sender: TObject);
begin
shockwaveflash1.Play;//繼續(xù)命令
n6.checked:=false;
end;

procedure TForm1.N9Click(Sender: TObject);
begin
shockwaveflash1.rewind;//返回第一幀命令
shockwaveflash1.play;
end;

end. 


標(biāo)簽:用delphi做flash播放器