[摘要]在窗体上添加opendialog1控件,一个timer控件,一个mianmenu控件, 一个trackbar1控件。 欢迎各位提出意见!! 以下是代码 unit flash; interface uses Windows, Messages, SysUtils, Classes, Graphi...
在窗体上添加opendialog1控件,一个timer控件,一个mianmenu控件,
一个trackbar1控件。
欢迎各位提出意见!!
以下是代码
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 //菜单打开的事件
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;//时间响应
end;
procedure TForm1.TrackBar1Change(Sender: TObject);
begin
trackbar1.position:=shockwaveflash1.FrameNum;//trackbar1的响应
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;//继续命令
n6.checked:=false;
end;
procedure TForm1.N9Click(Sender: TObject);
begin
shockwaveflash1.rewind;//返回第一帧命令
shockwaveflash1.play;
end;
end.
……