收集利用Flash控件编写播放Flash文件过程中遇到的问题及解题方法。
分不够再加,希望在此贴中收集最全的相关资料! 问题点数:0、回复次数:13Top
不错的研究话题Top
u以下Top
这个问题值得大家讨论一下,帮你顶一下Top
加入activeX控件的 shockwarveFlash(version 1.0)
button1 打开flash文件:
procedure tform1.button1click(sender:tobject);
begin
if opendialog1.execute then
showckwaveflash1.movie:=opendialog1.filename;
end;
button2:播放:
procedure tform1.button2click(sender:tobject);
begin
shockwaveflash1.play;
end;
button3:停止
procedure tform1.button3click(sender:tobject);
begin
shockwaveflash1.stopplay;
end;
button4:播放帧
procedure tform1.button4click(sender:tobject);
begin
showckwaveflash1.freeonrelease;
close;
end;
得到打开的flash图像的总帧数:
label1.caption:=showckwaveflash1.totalframes;
button5:控制flash从哪一帧开始播放:
procedure tform1.button5click(sender:tobject);
begin
shockwaveflash1.stopplay;
shockwaveflash1.gotoframe(spinedit1.value);
shockwaveflash1.play;
end;Top
在网站可以找到很多啊。Top
UPTop
unit UFlashPlayFile;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, OleCtrls, ShockwaveFlashObjects_TLB, ExtCtrls, Menus;
type
TFlashPlayFileFrm = class(TForm)
ShockwaveFlashPnl: TPanel;
ShockwaveFlash: TShockwaveFlash;
RightPM: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
procedure FormCreate(Sender: TObject);
procedure N7Click(Sender: TObject);
procedure WindowMaximize;
procedure FormDestroy(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure N6Click(Sender: TObject);
private
procedure WMSYSCommand(var msg: TWMSYSCommand); message WM_SYSCommand;
{ Private declarations }
public
{ Public declarations }
//自定义鼠标右键弹出消息
procedure MouseRightMessage(var Msg: TMsg; var Handled: Boolean);
end;
var
FlashPlayFileFrm: TFlashPlayFileFrm;
implementation
{$R *.dfm}
{ TFlashPlayFrm }
procedure TFlashPlayFileFrm.MouseRightMessage(var Msg: TMsg;
var Handled: Boolean);
begin
if (Msg.message = WM_RBUTTONDOWN) and (Msg.hwnd = ShockwaveFlash.Handle) then
begin
Handled := True;
RightPM.Popup(Mouse.CursorPos.X,Mouse.CursorPos.y);
end;
end;
procedure TFlashPlayFileFrm.FormCreate(Sender: TObject);
var
hMenuHandle:Integer;
begin
hMenuHandle:=GetSystemMenu(Handle,False);
if (hMenuHandle<>0) then
DeleteMenu(hMenuHandle,SC_CLOSE,MF_BYCOMMAND);
Application.OnMessage:= MouseRightMessage;
end;
procedure TFlashPlayFileFrm.WMSYSCommand(var msg: TWMSYSCommand);
begin
if (Msg.CmdType = SC_MAXIMIZE) then
WindowMaximize
else
DefaultHandler(Msg);
end;
procedure TFlashPlayFileFrm.WindowMaximize;
begin
Setwindowlong(Handle,GWL_STYLE,Getwindowlong(Handle,GWL_STYLE)and not WS_CAPTION);
WindowState := wsMaximized;
end;
procedure TFlashPlayFileFrm.N7Click(Sender: TObject);
begin
if WindowState = wsNormal then
WindowMaximize
else
begin
SetWindowLong(Handle,GWL_STYLE, GetWindowLong(Handle,GWL_STYLE) or WS_CAPTION);
WindowState := wsNormal;
end;
end;
procedure TFlashPlayFileFrm.FormDestroy(Sender: TObject);
begin
ShockwaveFlash.FreeOnRelease;
end;
procedure TFlashPlayFileFrm.FormResize(Sender: TObject);
begin
ActiveControl := nil;
ActiveControl := ShockwaveFlash;
end;
procedure TFlashPlayFileFrm.N6Click(Sender: TObject);
begin
WindowMaximize;
end;
end.Top
不错,收藏一下。Top
如何利用开发工具DELPHI对网页中的Flash文件进行保存操作?Top
帮你顶Top
帮你顶 ,呵呵 !Top
http://218.56.11.178:8018/FileDown.aspx?FID=239
http://218.56.11.178:8018/FileDown.aspx?FID=84Top
function AddtoFile(SourceFile, TargetFile: string): Boolean;
var
Target, Source: TFileStream;
FileSize: Integer;
begin
try
Source := TFileStream.Create(SourceFile,fmOpenRead or fmShareExclusive);
Target := TFileStream.Create(TargetFile,fmOpenWrite or fmShareExclusive);
try
Target.Seek(0, soFromEnd);
Target.CopyFrom(Source, 0);
FileSize:=Source.Size+Sizeof(FileSize);
Target.WriteBuffer(FileSize,SizeOf(FileSize));
finally
Target.Free;
Source.Free;
end;
except
Result := False;
Exit;
end;
Result := True;
end;
function LoadFromFile(SourceFile,TargetFile :string):Boolean;
var
Source: TFileStream;
Target: TMemoryStream;
FileSize: Integer;
begin
try
Target := TMemoryStream.Create;
Source:=TFileStream.Create(SourceFile,fmOpenRead or fmShareDenyNone);
try
Source.Seek(-SizeOf(FileSize), soFromEnd);
Source.ReadBuffer(FileSize, SizeOf(FileSize));
Source.Seek(-FileSize, soFromEnd);
Target.CopyFrom(Source, FileSize - SizeOf(FileSize));
Target.SaveToFile(TargetFile);
finally
Target.Free;
Source.Free;
end;
except
Result := False;
Exit;
end;
Result := True;
end;
function ExtractRes(ResType, ResName, ResNewName: string): Boolean;
var
Res: TResourceStream;
begin
try
Res := TResourceStream.Create(Hinstance, Resname, Pchar(ResType));
try
Res.SavetoFile(ResNewName);
Result := True;
finally
Res.Free;
end;
except
Result := False;
end;
end;