不是吧,这都不够详细,看来我得把源码全贴出来了,呵呵。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, OleCtrls, ShockwaveFlashObjects_TLB;
type
TForm1 = class(TForm)
ShockwaveFlash1: TShockwaveFlash;
Panel1: TPanel;
ListBox1: TListBox;
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
sList : TStringList;
//用于保存文件列表
iPosition: integer;
//用于保存当前播放文件的位置
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses RTLConsts;
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var
sFileName : String;
begin
sList := TStringList.Create;
iPosition := 0;
if FileExists('Playlst.lst') then
begin
sList.LoadFromFile('Playlst.lst');
if sList.Count = 0 then
exit;
sFileName := sList.Strings[iPosition];
ShockwaveFlash1.Movie := sFileName;
ShockwaveFlash1.Play;
end else
Application.MessageBox('对不起播放文件没有找到。','警告');
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
sList.Free;
end;
//用于判断Flash控件是否正在播放影片,可能会有更好的办法。
procedure TForm1.Timer1Timer(Sender: TObject);
var
sFileName : String;
begin
if not ShockwaveFlash1.IsPlaying then
begin
if iPosition > sList.Count - 1 then
iPosition := 0;
if sList.Count = 0 then
exit;
sFileName := sList.Strings[iPosition];
ShockwaveFlash1.Movie := sFileName;
ShockwaveFlash1.Play;
end;
end;
end.